The Supreme Court ruled Monday that the government can ban campaign contributions from advocacy groups, a warm-up decision to the showdown over the broader new campaign finance law.

In a batch of opinions, the justices also said there were limits on when courts can medicate mentally ill defendants against their will in order to make them competent for trial, and upheld a government ban on loitering on public housing sites.

In the campaign finance case, justices rejected a constitutional challenge to the 32-year-old federal donation ban, which applies to groups with a point of view on issues such as gun rights and abortion.

The case, involving a North Carolina anti-abortion organization, was a prelude to the court's handling of the 2002 campaign finance law.

By a vote of 7-2, the court said the right to free speech does not trump Congress' goal of limiting the corrosive effects of corporate money in politics.

Advocacy organizations maintain that their members should be allowed to pool their money and use it to elect candidates who support their issues.

The government maintained that the groups could be used to circumvent individual campaign donation limits, with little public disclosure about the source of the money.

"Any attack on the federal prohibition of direct corporate political contributions goes against the current of a century of congressional efforts," Justice David Souter wrote for the majority.

The donation ban is not directly related to the court's review of the new campaign finance law, but the ruling will be closely watched for clues to what the justices might do.

The court has scheduled a special session in September, a month ahead of the start of its regular term, to consider the law that bans corporate, union and unlimited contributions — known as soft money — to national party committees.

The new law also bars a range of interest groups, including those financed with corporate or union money and those that do not disclose their donors, from airing ads mentioning federal candidates in their districts the month before a primary and two months before a general election.

When Congress rewrote the campaign finance rules, it did not change the 1971 law that makes it unlawful for any type of corporation to give money to a federal candidate or political party.

Currently, only individuals, political parties, political action committees and other campaigns can contribute to federal candidates and national party committees.

The court's ruling Monday maintains that status quo and continues a trend in which the high court has been willing to uphold limits on contributions.

In 2001, the court ruled that political parties could not spend unlimited amounts of money if they coordinated their efforts with a candidate. And in 2000, the court voted to back Missouri's contribution limits to state campaigns.

Elizabeth Garrett, a law professor at the University of Southern California, said the case is important because issue-oriented nonprofits have become increasingly important in campaigns.

She said it also means that provisions in the new campaign finance act that require nonprofit corporations, as well as for-profit corporations and labor unions, to use separate funds to pay for political advertisements are more likely to survive the court's review.

"The decision is a green light for other laws regulating these organizations and their involvement in campaigns, such as aggressive disclosure laws," said Garrett.

In the other cases:

The court unanimously ruled that the government may designate crime-ridden public housing neighborhoods as off limits to visitors and prosecute some trespassers. They tossed out an appeal by a man who claimed he was wrongly prosecuted for trespassing at a housing complex in Richmond, Va., where his mother and two children live.

In a defeat for prosecutors, the justices ruled 6 to 3 that the government will have to revise a common practice now of putting defendants on anti-psychotic drugs for their trials. Justices said that the Constitution allows the government to administer drugs only "in limited circumstances."

The federal government puts hundreds of defendants on medication each year to make them competent to stand trial. Most take the drugs willingly. In a recent 12-month period, 59 people were medicated against their wishes and about three-fourths were restored to competency, the government has said.

In a series of decisions more than a decade ago, the Supreme Court ruled that inmates considered dangerous could be forced to take medication and that defendants in criminal trials could be required to take drugs if it was medically appropriate.

The latest ruling dealt with the rights of people facing less serious charges who do not want to take anti-psychotic drugs.

In a dissent, Justice Antonin Scalia, joined by Justices Sandra Day O'Connor and Clarence Thomas, said that the ruling was narrow, but that it would allow some criminal defendants "to engage in opportunistic behavior" to thwart prosecutions.

CBS News legal analyst Andrew Cohen says: "This ruling is going to encourage defendants who want to oppose a forced medication program to do so but it's certainly not going to guarantee that the defendant prevails, especially where the government can show he or she may be dangerous."