— The Czech Republic’s highest court on Monday upheld a government plan to pay billions of dollars to religious groups in compensation for property the country’s former Communist regime seized from them.

The ruling is a big victory for the country’s churches, which have been fighting since the 1989 fall of communism to get back assets such as farms, woodlands and buildings that have remained in the state’s hands.

Under the plan, 16 religious groups, including Catholics, Protestants and Jews, will get about $3 billion in compensation over the next 30 years. They will also get 56 percent of their former property now held by the state, estimated to be worth $3.8 billion. The state, meanwhile, will gradually stop covering church expenses over the next 17 years.

Prague archbishop Dominik Duka celebrated the ruling as completing efforts to find a “just” solution to the 41 years of repression during the Communist era. His Catholic Church will receive most of the money and property in the deal.

The Constitutional Court rejected an appeal by the republic’s left-wing opposition, which expressed its disappointment.

The plan is highly controversial in a country with one of Europe’s highest concentrations of atheists.

The Communists seized power in 1948 in what was then Czechoslovakia, a mostly Christian country.

The Communists confiscated all the property owned by churches and persecuted many priests. Churches were allowed to function only under the totalitarian state’s strict control, and priests’ salaries were paid by the state.