The U.S. Supreme Court ruled Thursday that it is a violation of the First Amendment to the Constitution for the federal government to force groups to endorse the government's views in order to receive funding to combat AIDS overseas.

The justices ruled 6 to 2 that a requirement in an anti-AIDS program withholding money from organizations that do not have a policy "explicitly opposing prostitution and sex trafficking" violates their free-speech rights.

"This case is not about the government's ability to enlist the assistance of those with whom it already agrees," wrote Chief Justice John Roberts Jr. "It is about compelling a grant recipient to adopt a particular belief as a condition of funding."