WINNIPEG -- The federal government has issued an ultimatum to the owners of a broken rail line that has cut off the town of Churchill in northern Manitoba -- fix it within 30 days or face an $18.8-million lawsuit.

Ottawa says Denver-based Omnitrax, which bought the rail line from the government in 1997, has a legal obligation to repair and maintain the line, which is the only land connection to the subarctic community on the coast of Hudson Bay.

Transport Canada points to a 2008 agreement with Omnitrax that included $18.8 million in federal support for repairs and upgrades.

"Notwithstanding that your Sept. 6 letter indicated you would be effecting the necessary repairs to the (rail line), you have since failed to do so, and time is running out with winter's approach," reads a letter sent to Omnitrax by Transport Canada on Friday.

"As a result of the above, it has become clear to Transport Canada that (the company) is in default of its obligations under ... the agreement."

Omnitrax responded by saying the rail line is no longer economically viable, due largely to federal government decisions that include ending the Canadian Wheat Board's monopoly on western wheat and barley. The wheat board used to ship grain along the rail line to the Port of Churchill.

"It is our view that, as a result of the federal government's actions -- or inactions -- recently and over the past 10 years, the (rail line) is not commercially viable," Omnitrax Canada president Merv Tweed said in a written statement.

"Culminating in the threat of legal action from Transport Canada today, it has become clear to us that the federal government has no intention of constructively solving this problem for Churchill."

The 250-kilometre rail link was severely damaged by flooding last spring and Omnitrax has said it cannot afford an estimated $43 million in repairs.

For months, goods and people have had to be flown in at a high cost. The town of 900, known for its polar bears and beluga whales, has seen a dramatic drop in tourism numbers as well.

Prime Minister Justin Trudeau said in July that the government was willing to use all options to force Omnitrax to get the line running again.

Even if Omnitrax were to start repairs immediately, a 30-day time frame is likely too short.

A recent report from independent engineering firm AECOM projected 60 days would be needed to get the track fixed well enough to handle lighter loads, and another 90 or so days next spring to be fully repaired.

The Manitoba government recently increased its subsidy for some food to Churchill and ordered large amounts of propane to be sent by ship to ensure that homes have enough heating fuel to last through the long winter and spring.

Omnitrax has been in talks to sell the rail line to a consortium of northern Manitoba communities and businesses -- a move that would likely require government aid. Natural Resources Minister Jim Carr, who represents Manitoba in the federal cabinet, said Friday he is hopeful a deal may come soon.

"We understand that the partnership is very close to a deal and the elements are in place."

Tweed's statement hinted at another result, but provided no details.

"While we remain of the view that the best outcome for all concerned is a negotiated sale to the First Nations coalition, based on Transport Canada's actions today, we are now contemplating steps to bring this protracted matter to a close."

Even if Omnitrax was to start repairs immediately, a 30-day time frame is too short, according to a recent report from an independent engineering firm, AECOM.

The report projected 60 days would be needed to get the 250-kilometre stretch of track repaired enough to handle lighter loads, and another 90 or so days next spring to be fully repaired.

The Manitoba government recently increased its subsidy for some food to Churchill and ordered large amounts of propane to be sent by ship to ensure that homes have enough heating fuel to last through the long winter and spring.

Omnitrax has been in talks to sell the rail line to a First Nations consortium, but there is no sign that the deal is close to being done.