Israeli rescue workers said a third person, a woman in her 20s, hid from the attackers to avoid being shot.
Shortly after the shooting in the village of Halhul, Hamas and Islamic Jihad took responsibility for the attack.
But al-Safi said the two accused were not affiliated with either of the groups.
Israel has said it will not loosen its grip on the West Bank until the security forces loyal to Mahmoud Abbas, the Palestinian president, rein in fighters there.
Abbas's government condemned the attack on the soldiers and has said it was meeting its security obligations by carrying out a crackdown in West Bank cities.