Belfast Police were attacked in Belfast on Monday night by loyalists enraged by a decision to remove the British flag from Belfast City Hall, which has sparked eight consecutive days of protests.
About 15 masked men broke out of a crowd assembled in the predominantly Protestant Newtownards Road area, smashed the windows of a police car and threw a petrol bomb into it while an officer was still inside, police said.
The officer escaped unharmed but the Police Service of Northern Ireland (PSNI) said they were treating the attack as attempted murder.
The attack was one of a series of protests across the city on Monday during which stones and fireworks were hurled at police, who responded with water cannon in at least two locations.
Loyalists have been protesting against a decision by Irish nationalist city councillors from Sinn Fein and the SDLP to take down the flag which had flown above the provincial capital's city hall every day since it opened in 1906.
The decision by councillors means Britain's 'Union Jack' flag will now fly on 17 days during the year, as is the case at the provincial assembly at Stormont in the British-controlled province.
"This was a planned attempt to kill a police officer which also put the lives of the public in danger," Assistant Chief Constable George Hamilton said.
The attack happened outside the constituency office of Naomi Long, a member of the British parliament for the non-sectarian centrist Alliance party.
Long was forced to flee her home last week after receiving threats over her party's support of the removal of the flag from City Hall.
Later on Monday night, police separated rival loyalist and republican crowds rioting in a flashpoint area between the loyalist east Belfast and the small nationalist Short Strand enclave.
Violence has raged for seven of the last eight days since the decision, in Belfast and around the and nearly 30 officers have been injured.
About 10 people have appeared in court charged with offences linked to the rioting - the youngest just 13 years of age.
Violence between the province's mainly Catholic republicans and pro-British Protestants, which raged on and off for three decades, has largely ended since a peace agreement was signed in 1998, but much of Belfast remains divided along sectarian lines.
(Reporting by Ian Graham; Writing by Stephen Mangan; Editing by Michael Roddy)