Image caption Staff were told the news at a mass meeting at the plant

Political leaders and unions have welcomed news that the Grangemouth petrochemical plant is to stay open after a deal was struck with workers.

Operator Ineos had announced on Wednesday that the plant was to shut, with the loss of 800 jobs, after union members rejected a survival plan.

But the decision was reversed after the union agreed to Ineos's conditions.

Ineos founder and chairman Jim Ratcliffe said it was "a victory for common sense".

He confirmed Ineos would now press ahead with plans to invest £300m in a new gas terminal at the site, following a "significant change in attitude" from the Unite union.

He added: "We have had assurances from the union yesterday that the changes we have requested in order for us to invest in that facility have been agreed and we are delighted to announce that Grangemouth will restart today, both the refining and petrochemicals side."

The announcement on Grangemouth's future was greeted by huge cheers from the workforce, who had gathered at the plant to be told the news.

Media playback is unsupported on your device Media caption Jim Ratcliffe, chairman of Ineos, said there had been a "significant change in attitude" from the unions

The move brings to an end a bitter dispute with the Unite union which began over the alleged mistreatment of a Unite official and escalated to the threat of strike action.

This was dropped but Ineos shut down the plant and issued an offer of revised terms and conditions in a survival plan, which was initially rejected by union members.

Unite has been accused of mishandling the negotiations, but the General Secretary of the Scottish TUC, Graham Smith said Unite officials were always prepared to be flexible but were hamstrung by the management's refusal to be reasonable.

"I think they've been placed in a very difficult position by an employer who in my experience very uniquely walked away from its responsibilities that it had with the trade union, tried to impose its will on the workforce with a take it or leave it ultimatum," Mr Smith said.

Reacting to the announcement, Unite Scottish secretary Pat Rafferty said: "Relief will ring right round the Grangemouth community, and across Scotland today.

"Hundreds of jobs that would have been lost can now be saved and £300m will be invested into the plant."

The main points of the Ineos announcement included:

Ineos will reopen the petrochemical plant and oil refinery at Grangemouth immediately

Ineos has undertaken to invest £300m at the Grangemouth site on a gas terminal to handle shale gas brought in from America

Workers agreed to a three-year pay freeze

The union agreed not to stage strikes at the plant for three years until the new gas terminal is built

Changes will be made to current staff pension arrangements

Up to 2,000 contractors who were laid off after the complex was shut will be re-hired

First Minister Alex Salmond described the development as a "tremendous fillip for the workforce and the whole Grangemouth community, following what could have been a potential disaster".

He said it had been "a great team effort from all concerned", including the unions and workforce, the management and governments.

"I am delighted that people have rallied round to protect these jobs, and now we can all agree that Grangemouth has an outstanding future," he added.

Scottish Secretary Alistair Carmichael also welcomed the announcement, saying that it was "the news that we all wanted".

"The staff and their families have been through a very stressful and uncertain time," he added.

Media playback is unsupported on your device Media caption Grangemouth chairman Calum MacLean, right, makes the announcement

The announcement came as BP said it had reached an agreement with Ineos which would ensure that oil and gas supplies from the Forties Pipeline System would be secured.

The pipeline - which brings oil and gas ashore from more than 50 North Sea fields - as well as BP's processing plant at Kinneil depend on steam and power from Grangemouth.

BP said "some key commercial terms" had been adjusted in an existing deal with Ineos, but did not elaborate.

It added: "By doing this, we have ensured that over a third of the North Sea's total oil and gas supplies will be unaffected, and that our motorist and airline customers will enjoy supply security."

Ineos' future plans at Grangemouth include investing £300m in a new gas terminal at the site.

Grangemouth chairman Calum MacLean said: "It is a huge investment and that investment was only rightly to be done if we had a long-term sustainable base.

"What we have now done is given the chemicals business another 15 to 20 years on the back of new raw materials, new contracts and significant investment."

Mr MacLean would not dismiss the prospect of redundancies, but said they would be "very limited".

Media playback is unsupported on your device Media caption Alex Salmond says the Grangemouth plant has a "bright future"

The company has also said that 2,000 contractors it laid off after shutting down the complex would be re-hired to support investment in its survival plan.

According to Ineos, the Scottish government has indicated it would support its application for a £9m grant to help finance its gas terminal plans, while the UK government has given "pre-qualification approval" for a £125m loan guarantee facility.

Falkirk Council, which had planned to set up a task force to respond to the threatened closure, said the Ineos announcement was "the best possible outcome for all concerned".

Council leader Craig Martin added: "There has been a tremendous effort behind the scenes to secure the plant's future involving UK and Scottish governments and Falkirk Council, working together to ensure the plant's survival.

"This partnership approach has paid off and a more stable and positive future for the workforce has been delivered."