A divided US Supreme Court has struck down a law that would allow American citizens born in Jerusalem to have Israel listed as their birthplace on passports, saying it unlawfully encroached on the president's powers to set foreign policy.

The 6-3 vote ruling, a victory for President Barack Obama, comes at a time of strained relations between Israel and the US, the country's most important ally.

The Obama administration had said that if the law were enforced, it would have undermined the US government's claim to be a neutral peacemaker in the Middle East.

Writing for the court, Justice Anthony Kennedy conceded that the US Congress, which enacted the law in 2002, has a role to play in foreign policy but cannot make decisions on recognising foreign governments. That is the president's "exclusive power", Kennedy wrote.

"Congress cannot command the president to contradict an earlier recognition determination in the issuance of passports," added Kennedy, a conservative who often holds the key vote in close cases.

Ari and Naomi Zivotofsky, the American parents of now-12-year-old Menachem Zivotofsky, had waged a long court battle to have the boy's passport state he was born in Israel.

'Delicate subject'

The case touched upon what Kennedy called the "delicate subject" of Jerusalem's status. The city, considered holy to Muslims, Jews, and Christians, is claimed by both Israelis and Palestinians and has been a major point of contention in the Middle East for decades. The justices took no position on that issue.

OPINION: US and the Middle East: Conspiracy and collusion

An estimated 50,000 American citizens were born in Jerusalem and could, if they requested it, list Israel as their birthplace if the law had been enforced, according to the Reuters news agency.

The court was divided, with its four liberals joining Kennedy in the majority. One of the court's conservatives, Justice Clarence Thomas, agreed with the outcome but differed over the legal rationale.

The court's other conservatives, Chief Justice John Roberts, Justice Antonin Scalia and Justice Samuel Alito, all dissented, saying the law did not involve recognition of a foreign government.

Congress passed the law when George W Bush was president, but neither his administration nor the current Obama administration ever enforced it.