WASHINGTON — The Supreme Court struck down as unconstitutional Monday a congressional attempt to allow Americans born in the contested city of Jerusalem to list Israel as their birthplace on passports, affirming the principle that the president alone has the power to recognize foreign nations.

The divided court treaded carefully in dealing with the “delicate subject” that is Jerusalem’s sovereignty, as well as previously unsettled disputes between presidents and Congress about the conduct of foreign policy.

But a majority of the court came down decisively on the side of the executive branch when the question is the recognition of foreign countries and their territorial boundaries.

“Put simply, the nation must have a single policy regarding which governments are legitimate in the eyes of the United States and which are not,” wrote Justice Anthony M. Kennedy. And if the nation must speak with one voice, “that voice must be the President’s.”

Every president since President Harry Truman has declared that the recognition of Israel as a close and trusted ally does not include agreement about the disputed sovereignty of Jerusalem. Both Israelis and Arabs assert claims on the city, and the U.S. has said neutrality on its part is essential in trying to broker a lasting peace in the area.

The court was considering an attempt by Congress in 2002 to allow Americans born in Jerusalem to list Israel as a birthplace on U.S. passports if that is what the parents want. President George W. Bush said he would not allow the State Department to honor the request, and President Obama has continued the practice.

The vote to strike down the law was 6 to 3, with the court’s four liberals – Justices Ruth Bader Ginsburg, Stephen G. Breyer, Sonia Sotomayor and Elena Kagan – joining Kennedy’s opinion. Justice Clarence Thomas said the law was unconstitutional, but he did not endorse Kennedy’s reasoning.

Chief Justice John G. Roberts Jr. said the court had ventured into unmarked and treacherous territory.

“The court takes the perilous step – for the first time in our history – of allowing the president to defy an act of Congress in the field of foreign affairs,” he wrote in a dissent that was joined by Justice Samuel A. Alito Jr.

He said the majority was wrong that Congress was forcing the president’s hand on recognition simply by allowing the passport change. He said the decision was “based on the mere possibility that observers overseas might misperceive the significance of the birthplace designation.”

The case was brought by Menachem Binyamin Zivotofsky, a boy born in 2002 who made his second trip to the Supreme Court to present the justices with a major separation of powers case.