The Supreme Court seemed conflicted Monday on the question of whether the federal government can force groups that receive funding for overseas anti-HIV/AIDS programs to adopt its views against prostitution and sex trafficking.

And Chief Justice John G. Roberts Jr. pointed out the quandary, asking the first question to each of the lawyers arguing the case.

Deputy Solicitor General Sri Srinivasan said that Congress decided to renounce prostitution and sex trafficking because they contribute to the spread of diseases.

“Correspondingly, Congress determined. . . . that the government should partner with and should grant limited competitive federal funding to those organizations that agree with the policy,” Srinivasan said.

But, Roberts asked, what if that is incidental to the group’s core mission?

“There have to be some limitations on what type of loyalty oath you can require them to sign, isn’t there?” Roberts continued.

But when David W. Bowker rose to tell the court that the AIDS-fighting organizations he represents should not have to “profess a personal belief” imposed by the government, Roberts had a question for him:

“Why would they [government officials] want to sign up with somebody who didn’t share the objectives of the program?” he asked.

And so it went for an hour of questioning, as the court balanced the federal government’s right to fund organizations that share its goals with the First Amendment rights of groups that say the government’s conditions hinder their ability to achieve their goals.

The disputed provision is part of a 2003 law under which the United States is spending $60 billion to combat infectious diseases around the world. It says no funds may be given to a group or organization “that does not have a policy explicitly opposing prostitution and sex trafficking.”

But the groups that do the work said the requirement, which has not been enforced because of legal challenges, could undermine their anti-AIDS efforts because they often must work with those involved in prostitution. Besides, they argued, it is an intrusion on their free-speech rights.

The U.S. Court of Appeals for the 2nd Circuit agreed with the groups.

“Compelling speech as a condition of receiving a government benefit cannot be squared with the First Amendment,” a panel of the court decided 2 to 1.

Srinivasan said Congress was not trying to force groups to change their views. He said it sought only to give funds to the groups that already share the government’s views.

But Justice Samuel A. Alito Jr. was skeptical. “I’m not aware of any case in which this court has held that it is permissible for Congress to condition federal funding on the recipient’s expression of agreement with ideas with which the recipient disagrees,” he said, adding it would be a “dangerous precedent” to permit such “compelled speech.”

Justice Ruth Bader Ginsburg made similar points, and Justice Sonia Sotomayor said the government’s case might be stronger if it did not grant exceptions to the policy. Groups such as the World Health Organization and U.N. organizations are not required to adopt such policies.

Still, Bowker faced questions about why Congress couldn’t consider the policies of the groups when awarding grants.

For example, can’t Congress fund the Boy Scouts of America simply because it likes the group’s programs? asked Justice Antonin Scalia. “They have to treat them equivalently with the Muslim Brotherhood? Is that really what you’re suggesting?”

Bowker also tried to make clear that the organizations he represented — among them, Alliance for Open Society International and Pathfinder International, which operate programs around the world — “do not promote prostitution, nor do they approve of it.”

“They merely want to be free in their own private programs to operate those programs as they see fit.”

The case will be decided by only eight of the justices. Justice Elena Kagan recused herself, presumably because she worked on the case while serving as President Obama’s solicitor general.

The case is Agency for International Development v. Alliance for Open Society, Intl .

Discuss this topic and other political issues in the politics discussion forums.