A judge in Quebec has approved a bid to save Davie shipyard Thursday — a deal that could mean competition for Halifax and Vancouver on two major federal shipbuilding contracts.

The Quebec Superior Court said late Wednesday night that an agreement was being worked on to rescue the financially troubled company.

The Davie shipyard, on the St. Lawrence River in Lévis, Que., has been in creditor protection for more than a year. The Upper Lakes Group, which owns shipyards in Ontario, is prepared to buy it as part of a joint venture with SNC-Lavalin and Daewoo of South Korea.

Davie must be solvent to qualify as a bidder for two federal shipbuilding contracts worth $33 billion.

Irving Shipbuilding Inc. of Halifax and the Vancouver Shipyards in North Vancouver are also in the running.

The federal government's deadline for bids is Thursday at 2 p.m. EST.

Just a couple of months ago, people at Davie Yards Inc. were in serious negotiations with a different company — Italy-based Fincantieri.

When that fell through, the world's second-largest shipbuilder joined forces with a St. Catharines, Ont., company to make an offer for Davie.

The sale has the potential to affect many more people that just those at Davie.

Stéphane Moisan, who works for a ventilation company that did work for Davie but was never fully paid, told CBC News that last year, when Davie fell under bankruptcy protection, he had to lay off 30 people.

Lawyers representing creditors, including the provincial government, were anxiously waiting to see if the Upper Lakes purchase would go through.