* Prime Minister Sharif asks army chief to "play his role"
* General could provide face saving solution for opposition
* About 10,000 protesters still camp out in central Islamabad (Updates throughout with army's role, quotes, sources)
By Maria Golovnina and Mehreen Zahra-Malik
ISLAMABAD, Aug 28 (Reuters) - Pakistan's army stepped into a political struggle between the country's embattled prime minister and the opposition on Thursday, signalling a possible end to a crisis that has destabilised the coup-prone nation.
Pakistan has been gripped by mass rallies for more than two weeks, with protesters led by cricketer-turned-politician Imran Khan and firebrand cleric Tahir ul-Qadri camped outside parliament demanding Prime Minister Nawaz Sharif resign.
Attempts to resolve the crisis through talks have failed, creating a deadlock and raising the spectre of violence as thousands of increasingly impatient activists, some armed with sticks, massed in the heart of Islamabad despite intense heat.
Addressing the roaring crowd late at night, Qadri said the army had offered to mediate in the stand-off, a proposal he immediately endorsed.
"The army chief has asked us to give him 24 hours to solve the crisis," he told thousands of flag-waving supporters. Khan, speaking shortly after him, echoed his remarks.
"The army will compile and put together a package of our demands and make sure they are implemented," Qadri added.
The army's press wing tweeted that army chief General Raheel Sharif would meet both opposition leaders late on Thursday. No other official comment was immediately available.
Some officials in Sharif's administration have accused the army itself of orchestrating the protests as a way to weaken the prime minister, and many believe that the fate of the anti-government movement ultimately lies in the military's hands.
Pakistan, a nuclear-armed nation of 180 million, has been ruled by the military for half of its entire history and has repeatedly swung between democracy and military. Sharif himself was toppled in a coup in 1999 during his previous tenure.
This time few observers expect the army to try to grab power again, although the prime minister seems sure to emerge significantly weakened from the crisis, with the military likely to further sideline him on security and foreign policy issues.
A military source told Reuters late on Thursday that the prime minister had asked General Sharif to "play his role" in resolving the conflict.
"All stakeholders have been requested to negotiating table to resolve the issue ... but it's just the beginning," the source said.
At least 10,000 people have crowded Islamabad's so-called Red Zone, where parliament, the prime minister's residence and embassies are located since Aug. 15. With many sleeping rough, the site is now littered with rubbish and reeks of human waste.
Tensions came to a head earlier on Thursday, with Qadri declaring it "Revolution Day" and security forces sealing off the protest site in case the crowd tried to storm nearby government buildings, which had been evacuated.
Both Qadri and Khan used fiery language throughout the day refusing to back down.
The army's mediation could provide a face-saving solution to both of them in a country where the military is still respected widely and seen as an antidote to a civilian government many resent for corruption and red tape.
When Qadri told the protesters that the army was getting involved, the crowded chanted and waved flags in approval.
Sharif, who met the country's powerful army chief earlier in the day, flew to the city of Lahore - his political powerbase - for a funeral but was expected back late Thursday night.
The demonstrations come at a difficult time for Pakistan, already plagued by an Islamist insurgency, sectarian tension and recurrent power shortages. Many Pakistanis are deeply unhappy with the government's performance since it came to power after winning an election in May last year. (Additional reporting by Mubasher Bukhari in Lahore, Sheree Sardar in Islamabad and Asim Tanveer in Multan; Writing by Maria Golovnina; Editing by Tom Heneghan)
Our Standards: The Thomson Reuters Trust Principles.