* Protests demanding PM resignation started in mid-August
* How crisis unfolds depends on army's actions
* Protesters clash with police, advance on PM house (Adds U.S. statement)
By Syed Raza Hassan and Maria Golovnina
ISLAMABAD, Sept 1 (Reuters) - Pakistani soldiers and paramilitary forces secured the state television headquarters in Islamabad on Monday after a crowd of anti-government protesters stormed the building and took the channel off the air.
Protesters led by opposition leaders Imran Khan, a hero cricket player turned politician, and firebrand Muslim cleric Tahir ul-Qadri have been on the streets for weeks trying to bring down the government of Prime Minister Nawaz Sharif.
Protests descended into deadly chaos over the weekend, with demonstrators clashing with police in a central area near many government buildings and embassies. Three people were killed.
Sharif, who was toppled by the army in a 1999 coup but staged a comeback with a big election win in May last year, has refused to quit while protest leaders have rejected his offers of talks, creating a dangerous deadlock.
Clashes broke out early on Monday and continued sporadically throughout the day. The state PTV channel and its English-language PTV World service were taken off the air after protesters stormed its headquarters.
A PTV source told Reuters the protesters had occupied the main control room and smashed some equipment. Uniformed members of a paramilitary force and soldiers later secured the building and the station later came back on the air.
In the nuclear-armed nation where power has often changed hands through military coups rather than elections, the army is bound to play a key role in how the conflict unfolds.
It has not directly intervened, apart from meeting the protagonists and calling on them to show restraint.
Army chief General Raheel Sharif met Prime Minister Sharif on Monday, but it was unclear what they discussed.
WRIT OF THE STATE
Defence Minister Khawaja Asif told Reuters the government was preparing to launch a selective crackdown against protesters, possibly later on Monday, and warned demonstrators against storming government buildings.
"The writ of the state must be enforced. We hope to make a decisive move sometimes later today, not in the evening but even before that," he said. "I personally feel that the next few hours will determine the course of coming events."
Protesters have camped out in Islamabad since mid-August, paralysing life in the centre of the capital and creating massive traffic jams. The protest site, where many sleep rough, is littered with rubbish and reeks of human waste.
How the crisis ends will be ultimately decided by the army. If the protests get out of hand, the military could step in decisively, imposing a curfew or even martial law.
There is also a question mark over how much protest leaders are capable of controlling their own people, many of them frustrated after weeks of hardship and no solution in sight.
Alternatively, the army could side with the protesters and put pressure on Sharif to resign, in which case an interim government would have be put in place and early parliamentary elections held to elect a new government.
However, few observers believe the army is bent on seizing power again. A weakened Sharif would allow the army to remain firmly in charge of key issues such as relations with India and Afghanistan while allowing the civilian government to deal with day-to-day economic problems in which it has little interest.
The United States, already concerned about regional stability at a time when most of its troops are leaving neighbouring Afghanistan, called for restraint by all sides, saying protesters had a right to demonstrate peacefully.
"Violence and destruction of private property and government buildings are not acceptable means of resolving political differences, however, and we strongly oppose any efforts to impose extra-constitutional change to the political system," State Department spokeswoman Jen Psaki said.
Some ruling party officials have accused elements within the military of orchestrating the protests to weaken the government.
Khan and Qadri have instructed their supporters to avoid any confrontation with the armed forces and strictly follow their orders. As soldiers entered the PTV building, many protesters smiled and shook hands with them.
The military insists it does not meddle in politics but it was known to be frustrated with the government, in particular over the treason trial of former military chief and ex-President Pervez Musharraf, who deposed Sharif in 1999.
There has also been disagreement on how to handle Islamist militants, and on relations with old rival India.
On Monday morning, despite heavy rain, crowds of protesters fought running battles with retreating police after breaking the main gate into the Pakistan Secretariat area which houses government ministries as well as Sharif's official residence.
After a brief lull during the day, protesters once again charged towards police lines in the so-called Red zone - home to the prime minister's house, parliament and foreign embassies - as they sought to reach the prime minister's house.
Sharif, who was prime minister twice in the 1990s, swept to office last year in Pakistan's first democratic transition of power. He is due to address both houses of parliament on Tuesday in an apparent effort to show that he is firmly in control.
Seeking to appear decisive as the conflict unfolded, the government has also registered treason cases against Khan and Qadri following the weekend clashes, the defence minister said.
But Sharif looks increasingly cornered, and even if he survives the crisis he is likely to remain significantly weakened for the rest of his tenure.
In a speech laced with populist slogans, Khan said he would not call off the protests until Sharif resigns. "Pakistan's Hosni Mubarak, who buys people with his money, was once thought of as indispensable, but today his legs are shaking," he said, likening Sharif to the ousted Egyptian leader. (Additional reporting by Mehreen Zahra-Malik in Islamabad and Matt Spetalnick in Washington; Editing by Tom Heneghan)