* Ruling seen as widening divisions in Libya

* Comes a day after gunmen stormed oilfield

* Libya seen on brink of full-blown civil war (Adds reaction of rival Tripoli-based parliament)

TRIPOLI, Nov 6 (Reuters) - Libya's Supreme Court declared the internationally recognised parliament on Thursday as unconstitutional, in a ruling likely to fuel further chaos in the north African oil producing nation.

The decision, which was rejected by the assembly, came a day after gunmen stormed Libya's biggest oilfield and shut down production at the facility in the country's remote south.

Libya is in chaos as two rival governments and parliaments are struggling for control of the country's vast energy reserves three years after the overthrow of veteran ruler Muammar Gaddafi. Dozens of armed groups have also joined the fray.

Western powers and Libya's neighbours fear the OPEC member nation is heading for a full-blown civil war, with former rebels who helped oust Gaddafi now using their guns to carve out their own fiefdom.

Libya is split into a western part controlled by fighters calling themselves Operation Dawn, who seized the capital in August, and a rump state in the east where the internationally recognised parliament and government are now based.

In a televised ruling likely to deepen these divisions and hamper the United Nations' mediation efforts, the Supreme Court invalidated the election of the House of Representatives, which has fled to the eastern city of Tobruk. The court said a committee that prepared the election law had violated Libya's provisional constitution.

The June election produced an assembly with a strong showing of liberals and federalists, annoying Islamists with links to Operation Dawn, which seized Tripoli two months later.

The Supreme Court is based in Tripoli, where Dawn has reinstated the previous parliament, the General National Congress (GNC), where Islamists had been stronger.

The fighters, who come mainly from the western city of Misrata, have taken control of state bodies, calling into question the court's ability to make independent rulings.

Hundreds of people were seen celebrating the court verdict in Tripoli and GNC head Nouri Abusahmain said it provided a chance for a national dialogue to end Libya's crisis.

"We the General National Congress call for dialogue," he said in a televised speech. "A dialogue serves national reconciliation, stability and development."

Responding to the ruling, the House of Representatives in Tobruk declared it did not recognise the court.

"The ruling was made under the threat of guns," the assembly's spokesman Farraj Hashem told a news conference.

There was no immediate response from Western and Arab powers which have recognised only the Tobruk-based assembly and have publicly boycotted a rival prime minister, Omar al-Hassi, installed by Tripoli's rulers.

The United Nations said in a statement it was studying the ruling, adding there was an "urgent need for all parties to forge consensus on political arrangements".

GUNMEN STORM OILFIELD

The decision came after gunmen stormed Libya's El Sharara oilfield on Tuesday and Wednesday, shutting down the country's biggest production facility in a blow to government efforts to keep the oil industry isolated from the spreading chaos.

It was not clear what happened exactly but rival tribes have fought over the area near the field twice in the past twelve months to press authorities to meet their financial and political demands.

Officials said on Thursday the gunmen had left the field. Oil company vehicles riddled with bullet holes could be seen on social media. A Libyan official said authorities hoped to restart production very soon but they needed to resolve local conflicts first.

The closure will lower Libyan oil production, last reported at around 800,000 bpd, by at least 200,000 bpd, worsening a budget crisis as oil revenues have been well below target due to repeated strikes across the country.

Some Libyan websites said the gunmen were linked to the Misrata-led alliance, but that could not be confirmed. Both sides -- the Tripoli rulers and the government in the east -- have an interest in keeping the oil flowing as their supporters are on the state payroll.

Authorities had managed to boost output in the past three months after it had slumped to 100,000 bpd due to protests.

Conditions in the poverty-stricken south of Libya have worsened since the seizure of Tripoli, which has hampered the work of government ministries and deprived the south of food, consumer goods and money from the central bank.

The fluid situation in the capital and the south has been exacerbated by a separate conflict in the main eastern city Benghazi between pro-government forces and Islamists.

More than 230 people have been killed since the army started an offensive there three weeks ago. (Reporting by Ulf Laessing, Mustafa Hashem Omar Fahmy, Ahmed Elumami and Ayman al-Warfalli; Editing by Gareth Jones)

Our Standards: The Thomson Reuters Trust Principles.