Norwegian police have arrested a man suspected of "Islamist terrorism" after two people were killed and 21 wounded in shootings near a gay bar in Oslo on Saturday, causing the city's Pride march to be cancelled.

But despite the official march being called off, thousands spontaneously gathered to march through the Norwegian capital in a display of unity also seen at Pride marches across Europe.

The shootings happened near the London Pub gay club, the Herr Nilsen jazz club, and a takeaway food outlet.

The suspect, who was already known to security services, was arrested quickly after the shooting started around 1am in central Oslo.

Police said the suspect was a 42-year-old Norwegian man of Iranian descent.

The two victims were men in their 50s and 60s, the police said, adding that the injuries of the wounded were not life-threatening.

A shattered glass wall of a pub, in the aftermath of the shooting outside pubs and nightclubs in Oslo

Norway's domestic intelligence service PST, which is responsible for counter-terrorism, said it was treating the attack as "an act of Islamist terrorism".

The suspect "has a long history of violence and threats", PST's chief Roger Berg said.

The suspect had been on the PST's radar "since 2015 in connection with concerns about his radicalisation" and membership "in an Islamist extremist network", Berg told a news conference.

Intelligence services spoke to the suspect last month, but did not consider him to have "violent intentions", Berg said.

He added that the PST was also aware the suspect had "difficulties with his mental health".

The suspect's lawyer, John Christian Elden, told Norwegian news agency NTB he expected his client to be put under "judicial observation" to determine his mental state, as is usually done in such cases.

The suspect has so far refused to be interviewed by investigators.

Generally peaceful Norway was the scene of bloody attacks on 22 July, 2011 when right-wing extremist Anders Behring Breivik killed 77 people.

He first detonated a bomb near the government headquarters in Oslo, killing eight people.

He then disguised himself as a policeman and went on a shooting spree at a summer camp for left-wing youth on the island of Utoya, killing another 69 people - most of them teenagers.