The attack comes at a time of heightened tensions in the West Bank and four days before Israel’s general election.