An oil company has been granted an injunction to stop Greenpeace posting photographs of an occupation of the company's offices on Twitter and Facebook.

Cairn Energy was given an interim interdict against a number of Greenpeace campaigners after they entered their Edinburgh headquarters on Monday.

Some of the protesters were dressed as polar bears.

The court of session in Edinburgh granted the injunction which is designed to prevent the protesters from doing anything similar at Cairn's offices in the future.

The injunction also bars the activists from trying to occupy the company's offices.

Cairn said it took the action to stop any confidential or commercially sensitive data being published.

A spokesman said: "As Cairn was unaware of the information that they may or may not have accessed, the interdict needed to cover the publication of any information they gathered while they were in the office.

"Cairn respects the rights of individuals and organisations to express their views in a safe and peaceful manner but would be concerned with any action that represents a breach of security and that may pose a risk to the safety of people and/or equipment."

But John Sauven, Greenpeace UK's executive director, said: "Cairn Energy is using its legal muscle to try and gag us from telling the truth about their dangerous oil drilling in the fragile Arctic environment.

"The company is clearly worried that our volunteers may have got their hands on their secret Arctic spill response documents and now they are determined to continue their cover-up by any means they can, even if that means impinging on important freedoms of expression."

Sauven continued: "Cairn's bosses can use their expensive lawyers to try and shut down our peaceful protests using chilling legal manoeuvres but we will continue to campaign to protect the Arctic from reckless corporations who see the melting of the polar ice as a business opportunity."

A number of campaigners were arrested during the protest action and appeared in court today.

Edinburgh sheriff court said 17 people, 10 women and seven men, were charged with attempted theft and contravening the Criminal Justice and Licensing (Scotland) Act 2010.

All 17 people were freed on bail.