(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)
<em>Pakistan's Prime Minister Yousuf Raza Gilani (C) is escorted by security as he waves upon his arrival at the Supreme Court building in Islamabad on April 26, 2012. (AAMIR QURESHI/AFP/GettyImages)</em><br><br> Gilani was summoned before the Supreme Court on Jan. 19 for failing to take steps to re-open money-laundering proceedings against President Asif Ali Zardari. He was indicted for contempt of court on Feb. 13.
<em>Former Pakistani president Pervez Musharraf speaks during a press conference in east London on January 19, 2012. (CARL COURT/AFP/Getty Images)</em><br><br>The civilian-judicial confrontation stems from thousands of cases thrown out in 2007 under an amnesty ordered by former military president Pervez Musharraf, which paved the way for a return to civilian rule.
<em>Asif Ali Zardari (C), widower of slain former Pakistani premier Benazir Bhutto speaks next to former premier Nawaz Sharif (R) during a joint press conference after their meeting at the Zardari's residence in Islamabad on February 21, 2008. (AAMIR QURESHI/AFP/Getty Images)</em><br><br> Zardari was the decree's most prominent beneficiary. He became the main target of the court when it voided the measure in 2009 and ordered the government to ask Swiss authorities to restart legal action against him.
<em>Demonstrators protest outside the International Convention Centre in central Birmingham on August 7, 2010 as President Zardari of Pakistan speaks to supporters during a visit to the England. (LEON NEAL/AFP/Getty Images)</em><br><br>The cases date back to the 1990s, when Zardari had multiple cases of corruption lodged against him, including accusations of money laundering using Swiss accounts. He says all the cases are false and politically motivated.
<em>Supporters of the ruling Pakistan Peoples Party (PPP) scuffle with police as they try to reach the residence of Supreme Court Chief Justice Iftikhar Mohammd Chuadhry after the contempt of court verdict handed to Pakistan prime minister Yousuf Gilani, during a protest, in Islamabad on April 26, 2012. (AAMIR QURESHI/AFP/GettyImages)</em><br><br>Gilani and his advisers have defied the court, citing the president's constitutional immunity as head of state. The prime minister appealed the court's decision to charge him with contempt, but that appeal was dismissed in February.