(Adds appeal, quotes)
By Mahawish Rezvi and Qasim Nauman
ISLAMABAD, April 26 (Reuters) - Pakistan's Supreme Court on Thursday found Prime Minister Yusuf Raza Gilani guilty of contempt of court for refusing to reopen corruption cases against the president, but gave him only a symbolic sentence of a few minutes' detention in the courtroom.
It was unclear if the token sentence would ease political tension in Pakistan, where the president and prime minister have jousted with the military and judiciary over the past year.
However, opposition leader Nawaz Sharif immediately demanded Gilani's resignation and some lawyers said the ruling automatically disqualified him from holding the post of prime minister.
"What they've done is taken it from the legal arena and chucked it into the political arena," said Cyril Almeida, a prominent columnist for the Dawn daily newspaper.
"There will be massive pressure from the opposition, the media, from civil society, saying 'He's been convicted for flouting the letter of the law and he should go home,'" Almeida said. "There will be a lot of pressure for him to resign."
Gilani's lawyer, Aitzaz Ahsan, said the prime minister would appeal against the ruling, which means uncertainty over his fate could drag on for months.
For more Pakistan stories click
or see http://link.reuters.com/kac58m
Pakistan blog: http://blogs.reuters.com/pakistan/
Military's grip on foreign policy easing
Pakistan says U.S. drone strikes must stop
Key political risks to watch in Pakistan
Gilani is the first serving prime minister in Pakistan's history to be convicted by a court, but his sentence - detention lasting just a few minutes until the session was adjourned - was symbolic. He could have faced up to six months in jail and the loss of office.
A throng of supporters surrounded Gilani as he walked into the court in Islamabad, showering him with rose petals. Security was tight, with about 1,000 police officers standing by in riot gear and helicopters circling the Supreme Court building.
The case stems from what many observers say is a political battle between the government and the military, which has held the whip hand in Pakistan's political arena for most of the country's 64 years of independence. Many say the army is using the court to keep the government on the back foot.
Thousands of corruption cases were thrown out in 2007 by an amnesty law passed under former military president Pervez Musharraf, which paved the way for a return to civilian rule. Two years later, the Supreme Court ruled that agreement illegal and ordered cases involving Swiss banks against President Asif Ali Zardari re-opened.
Gilani and his government have refused to obey the court's order to write to Swiss authorities asking them to re-open money laundering cases against Zardari. The government argues that Zardari has immunity as the head of state.
"This is a historic day. The court has declared a lawmaker a lawbreaker. This is weakening democracy in Pakistan," said Firdous Ashiq Awan, former information minister.
(Additional reporting and writing by Chris Allbritton; Editing by John Chalmers and Sanjeev Miglani)
Yusuf Raza Gilani, Pakistan Prime Minister, Convicted Of Contempt In Graft Case But Receives No Jail Time