HELENA, Mont. — Montana’s limits on direct contributions to political campaigns are justified in trying to prevent corruption or the appearance of corruption while still allowing candidates to raise enough money to run a campaign, the 9th U.S. Circuit Court of Appeals ruled Monday.

The decision overturned a ruling by U.S. District Judge Charles Lovell, who in May 2016 said the limits enacted by voters in 1994 restricted political speech.

“This lawsuit … sought to open the floodgates of money in Montana elections by making it easier for out-of-state corporations to buy officeholders,” Gov. Steve Bullock said in a statement. “I’m glad the federal courts upheld Montana’s limits on money in elections.

“For a century in Montana, winning an election for state office has meant going door to door and meeting face to face with everyday voters: democracy at its best. Today, we’re one step closer to keeping it that way. Elections should be decided by ‘we the people’ — not by corporations, millionaires, or wealthy special interests buying more television ads,” he said.

The Office of the Commissioner of Political Practices put the new limits into effect Monday, said spokesman Noah Horan. It would affect candidates currently running in local elections, but anyone who had received a campaign donation under the old limits would not have to return it.

Attorney Jim Bopp of Indiana said he planned to appeal the ruling, but hadn’t decided whether to ask a full panel of the 9th Circuit to reconsider the case or petition the U.S. Supreme Court to hear it. He has 10 days to seek an en banc hearing or 90 days to petition the high court.

Two members of the three-judge panel that heard Montana’s appeal said the state presented adequate evidence of attempts to persuade legislative action with campaign contributions and it wasn’t required to prove actual corruption. Judge Carlos Bea dissented, arguing there was no proof Montana lawmakers acted on those attempts.

Judges Raymond Fisher and Mary Murguia said Montana’s limits “target those contributions most likely to result in actual or perceived quid pro quo corruption — high-end, direct contributions with a significant impact on candidate fundraising.”

Bopp disagreed with their interpretation of the U.S. Supreme Court’s ruling in the Citizens United case.

“I’m very disappointed that the majority is not willing to apply the changes in the law that Citizens United has mandated,” that “only quid pro quo corruption can justify contribution limits,” Bopp said Monday. Under this ruling, you can “have your constitutional rights stripped from you because somebody can imagine that someone might do something wrong with those rights.”

The decision notes that would-be contributors are still free to volunteer their services, make donations to a candidate’s political party, send out direct mail or run other independent advertising. It also argues the limits do not favor incumbents or curtail the influence of political parties.

Attorney General Tim Fox, whose office argued the case, released a statement saying he was proud of the work his team did to defend the will of Montana voters.

Under the new limits, individuals and political action committees will be allowed to donate a maximum of $1,320 to a gubernatorial candidate in Montana while political parties will be allowed to donate $47,700. Those numbers will be adjusted for inflation before the 2020 elections. Limits are smaller for statewide races and legislative races.

During the 2016 election cycle, individuals could donate as much as $1,900 to a gubernatorial candidate, PACs could donate $10,610 and political parties could donate $23,850.

The appeals court said that while the donation limits seem low, they are quite reasonable when considering the cost of campaigning in Montana.

The case was filed in 2011 by American Tradition Partnerships, several political action committees and Republican central committees.