The state funeral in Beirut of an assassinated Lebanese intelligence chief has ended in violence as angry mourners broke away and tried to storm the offices of Prime Minister Najib Mikati.
The clashes fed into a growing political crisis in Lebanon linked to the civil war in neighbouring Syria.
Opposition leaders and their supporters accuse Syria of being behind the car bombing that killed Brigadier General Wissam al-Hassan on Friday.
They also say Mikati is too close to Syrian President Bashar al-Assad and his Lebanese ally Hezbollah, which is part of Mikati's government.
Thousands turned out in downtown Beirut's Martyrs' Square for Mr Hassan's funeral, which also served as a political rally.
The violence erupted after an opposition leader demanded that Mr Mikati step down to pave the way for talks on the crisis.
A group marched to the prime minister's office, then overturned barriers, pulled apart barbed wire coils and threw stones, steel rods and bottle at soldiers and police.
Security forces responded by shooting into air and firing teargas, forcing the protesters to scatter.
There were no immediate reports of casualties but the violence was nonetheless shocking to Lebanese who fear the Syrian conflict will spread to their country.
Opposition leader Saad al-Hariri urged supporters to refrain from any more violence.
"We want peace, the government should fall but we want that in a peaceful way. I call on all those who are in the streets to pull back," Hariri told supporters after the attack, speaking on the Future Television channel.
However as night fell groups of youths blocked the road to the international airport with piles of burning tyres. The highway south to Sidon was also cut.
The killing of Mr Hassan and the subsequent events have highlighted how the 19-month-old uprising against Mr Assad in Syria has exacerbated deep-seated sectarian tensions in Lebanon, which is still scarred from its 1975-1990 civil war.
Sunni-led rebels are fighting to overthrow Mr Assad, who is from the Alawite minority, which has its roots in Shi'ite Islam.
Lebanon's religious communities are divided between those that support Mr Assad and those that back the rebels.
Mr Hassan, 47, was a Sunni Muslim and senior intelligence official who had helped uncover a bomb plot that led to the arrest and indictment in August of a pro-Assad former Lebanese minister.
He also led an investigation that implicated Syria and the Shi'ite Hezbollah in the assassination of Lebanon's former prime minister Rafik al-Hariri in 2005.
Mourners at Martyrs' Square accused Syria of involvement in the killing and called for Mr Mikati to quit.
One banner read "Go, go Najib" echoing the slogans of the Arab Spring.
The violence broke out after Fouad al-Siniora, a former prime minister, said the opposition rejected any dialogue to overcome the political crisis caused by Hassan's killing unless the government first resigned.
"No talks before the government leaves, no dialogue over the blood of our martyrs," Mr Siniora said to roars of approval from the crowd.
At the start of the funeral, senior politicians and the military and security top brass turned out at the Internal Security Force headquarters for a ceremony held with full military honours and broadcast live on national television.
Mr Hassan's wife and two sons, the youngest weeping, listened as he was eulogised by the head of police, Ashraf Rifi, and President Michel Suleiman.
Mr Suleiman said the government and people must work "shoulder to shoulder" to overcome the challenges posed by the killing.
"I tell the judiciary do not hesitate, the people are with you, and I tell the security be firm, the people are with you, with you. And I tell the politicians and the government do not provide cover to the perpetrator."
In keeping with custom for state funerals, church bells pealed as police officers carried the flag-draped coffins of Mr Hassan and his bodyguard to the mosque on Martyrs' Square through chanting crowds.
Moslem prayers were broadcast by loudspeaker from the mosque.
Mr Mikati said yesterday that he had offered to resign to make way for a government of national unity but he had accepted a request by President Michel Suleiman to stay in office to allow time for talks on a way out of the political crisis.
Mr Mikati sought in vain to insulate the country from turmoil in its larger neighbour, which has long played a role in Lebanese politics.
He himself said he suspected Hassan's assassination was linked to his role in uncovering Syrian involvement in the August bomb plot.