HELENA, Mont. (AP) – The Crow Nation and the state have settled nearly four decades of litigation over whether Montana can tax coal owned by the tribe, with the state to pay $15 million if the tribe gives up claims on past taxes collected.

The dispute, which began in the 1970s, is over land near the Crow reservation in southeastern Montana that the tribe ceded to the U.S. more than a century ago. The tribe still owns the mineral rights to the coal-rich land, where the Westmoreland Coal Company leases the reserves and produces an average 5.5 million tons of coal through its Absaloka mine.

The state started charging severance and gross proceeds taxes on coal mined at the site in 1975, and the tribe soon after tried to impose its own severance tax. The U.S. Interior Department rejected the tribe’s tax for that land twice, and the tribe sued in 1978.

Federal courts ruled over the next several years that the state’s taxes interfered with the tribe’s right to self-government and were pre-empted by the federal Indian Mineral Leasing Act. The result of the rulings was that the state could not collect its taxes from the coal if the tribe was already doing so.

Under the settlement signed Thursday, the state does not surrender its power to collect severance and gross proceeds tax on the tribal coal. However, the state agreed that if the Crow tribe repeals its tax and Montana is able to start collecting the tax revenue again, the state would turn over that money to the tribe.

The settlement also calls for the state to give the tribe $15 million it agreed to under a 2012 Montana Water Rights Compact if the tribe gives up its pending appeals for the past tax revenue collected by the state. The money will go into an escrow account “for the benefit of the tribe,” according to the settlement.

Gov. Steve Bullock, Attorney General Tim Fox, Revenue Director Mike Kadas and Crow Chairman Darrin Old Coyote signed the agreement in Billings.

“The enforceability of our water settlement, the resolution of the coal severance litigation and the payment of the $15 million will enable to the Crow Nation to provide critical services to our tribal membership and will allow us to plan for the future of our nation,” Old Coyote said in a statement.

Bullock called the settlement a responsible agreement that will do the right thing for all residents of the state. Fox said the settlement was long overdue for the Crow tribe, which has experienced an unemployment spike since coal markets began to shrink.