The court said in 5-4 decision Monday that the content of the prayers is not critical as long as officials make a good-faith effort at inclusion.
The ruling was a victory for the town of Greece, N.Y., outside of Rochester.
In 1983, the court upheld an opening prayer in the Nebraska legislature and said that prayer is part of the nation's fabric, not a violation of the First Amendment. Monday's ruling was consistent with the earlier one.
Supreme Court Arguments
During arguments The Supreme Court wrestled with the appropriate role for religion in government in a case involving mainly Christian prayers at the start of a New York town's council meetings.
The justices tried out several approaches to the issue, including one suggested by the two Greece residents who sued over the prayers to eliminate explicit references to any religion.
Justice Samuel Alito pointed to the country's religious diversity to voice his skepticism about the call for only nonsectarian prayer.
"I just don't see how it is possible to compose anything that you could call a prayer that is acceptable to all of these groups," Alito said.
Greece was backed by the Obama administration and many social and religious conservative groups in arguing that the court settled this issue 30 years ago when it held that an opening prayer is part of the nation's fabric and not a violation of the First Amendment.
On the other side are Greece residents Susan Galloway and Linda Stephens who contend they and others who attend the meetings are a captive audience and should not be subjected to sectarian prayers.
Their argument appealed to Justice Sonia Sotomayor who asked Deputy Solicitor General Ian Gershengorn what he and others in the courtroom would do if Roberts "got up at the beginning of this session and said, 'All rise for a prayer." Gershengorn said, "I don't think many would sit, Your Honor."
People attending meetings in Greece wouldn't feel any differently, Sotomayor said.
"So why do you think that someone who is sitting in a small room where hearings of this nature are being held, when the guy who's about, the chairman of this legislative body, is about to rule on an application you're bringing to him or her, why do you think any of those people wouldn't feel coerced to stand?" she said.
The case is the first on prayer at government meetings since Marsh v. Chambers, the 1983 case that said prayer in the Nebraska Legislature did not violate the First Amendment's clause barring laws "respecting an establishment of religion," known as the Establishment Clause.