BILLINGS, Mont. (AP) — BNSF Railway has agreed to pay the U.S. government $200,000 and spend up to $750,000 on road repairs to settle claims that the company failed to pay for damages caused by a 2011 train derailment in northwestern Montana, government prosecutors and a railroad representative said Friday.

The settlement resolves a lawsuit brought against the Fort Worth, Texas, railway last year over a derailment of 18 cars from a train hauling wheat about 50 miles (80 kilometers) west of Whitefish.

An investigation found a broken wheel rim on the first car that derailed.

Prosecutors from the U.S. Attorney's Office for Montana alleged that during cleanup work, BNSF extensively damaged public roads on the Kootenai National Forest. The railway spent $223,000 for initial repairs but later refused to pay a $1.1 million bill from the government, according to court documents.

An estimated 30 miles (50 kilometers) of road were damaged, said Assistant U.S. Attorney Melissa Hornbein.

BNSF also trespassed on forest roads and failed to pay costs for annual road maintenance and overweight vehicle permit fees, prosecutors said.

BNSF agreed as part of the settlement to make an $80,000 annual road maintenance contribution through 2023, after which Hornbein said the payment would be renegotiated.

The payments are in addition to repair work that the company must spend by the end of next year totaling up to $750,000.

BNSF public affairs director Ross Lane said the company was pleased to have resolved the issue and to "clarify" BNSF's access to public lands to maintain and operate its rail lines. BNSF did not admit to any wrongdoing as part of the settlement.

U.S. Attorney Kurt Alme said in a statement that his office was committed to making companies that use public lands and roads for their business "pay their fair share for the wear and tear they cause to our public resources."