Canadian industrial construction company JV Driver, through its subsidiary DF Barnes, has acquired the marine engineering yard, which are being used to manufacture foundations for the Beatrice offshore wind project.
The Scottish government, which had brokered the acquisition agreement, will take a minority shareholding in the new company, it announced.
DF Barnes and JV Driver "will bring project expertise and financial security to the company as it bids for new contracts", the Scottish government added.
It is unclear at this stage whether any jobs will be lost.
Scottish economy secretary Keith Brown said: "This agreement gives the workforce, the company and the government the best possible chance of securing a vibrant future for these yards.
"There is a lot of hard work ahead, and there is no magic bullet for these yards, but the commitment of DF Barnes to securing a new future for the business at Burntisland, Methil (both in Fife) and Arnish is a hugely positive step and I believe that gives BiFab the best chance of winning future contracts and securing new work," Brown added.
BiFab had been contracted to provide jacket foundations for 26 of the 588MW Beatrice project’s 84 wind turbines, and two jackets and piles for its offshore transformer module.
But with the contract coming to an end, and no other outstanding contracts across its renewables, oil and gas or facilities divisions, the engineering yards in Fife in eastern Scotland and Arnish on the Isle of Lewis off the country’s west coast faced closure.
The company began a "collective consultation process" in February, whereby its workforce of 260 employees could have been cut by more than 20, it had stated.
That month, Iain Scrimger, BiFab’s business development manager told Windpower Monthly senior management was working with the Scottish government and trade union representatives "to do everything possible to avoid redundancies within the business".
The Scottish government has instructed BiFab not to comment further.
DF Barnes provides welding, fabrication, and industrial services, rigging equipment, and ship and offshore repair and maintenance, according to its website.
The company’s vice president in business development, Sean Power, said: "We are looking forward to a long and successful partnership with BiFab.
"We will work closely with management and the union representatives to ensure continuity for the people who work for the company.
"We are sensitive to the commitment that employees have made to BiFab and will work hard to meet their expectations."
Unite the Union, which represents BiFab’s employees, has been contacted for comment.