JERUSALEM  Israel’s Supreme Court ruled on Tuesday that a major access highway to Jerusalem running through the occupied West Bank could no longer be closed to most Palestinian traffic.

In a 2-to-1 decision, the court said the military overstepped its authority when it closed the road to non-Israeli cars in 2002, at the height of the second Palestinian uprising. The justices gave the military five months to come up with another means of ensuring the security of Israelis that permitted broad Palestinian use of the road.

“The court was saying that you can’t reasonably find every Palestinian inhabitant to be a security risk,” said Moshe Negbi, a legal commentator for Israel Radio, in a telephone interview. “The security considerations are legitimate, but they have to find other solutions.”

The closely watched case, argued by the Association for Civil Rights in Israel, was brought by a half-dozen Palestinian villages where land was expropriated for the road and inhabitants were barred from using it.