The suspect was overpowered by an elderly worshipper, police and witnesses said.

The shooting at a mosque near Oslo is being treated as an "attempted act of terror", Norwegian police said Sunday, with the suspect appearing to harbour far-right, anti-immigrant views.

"We are looking at an attempted act of terror," acting chief of the police operation Rune Skjold told a press conference after Saturday's incident left one man injured.

Skjold said the investigation had shown that the man appeared to hold "far-right" and "anti-immigrant" views.

The suspect, armed with multiple weapons, opened fire in the mosque in Baerum, a suburb of Oslo, on Saturday afternoon, before being overpowered by a man who suffered "minor injuries" in the process.

Norway was the scene of one of the worst-ever attacks by a right-wing extremist in July 2011, when 77 people were killed by Anders Behring Breivik.

Hours after the attack on Saturday, the body of a young woman related to the suspect was found in a home also in Baerum.

Investigators are treating her death as suspicious and have opened a murder probe.

Police said earlier Sunday they had tried to question the suspect, described as a "young man" with a "Norwegian background" who was living in the vicinity but he did not want to "give an explanation to police".

The man had been known to police before the incident but according to Skjold he could not be described as someone with a "criminal background".

On Saturday, Norwegian media reported that the suspect was believed to have put up a post to an online forum hours before the attack where he seemingly praised the assailant in the attacks on two mosques in Christchurch, New Zealand in March, when 51 people where killed.

The suspect in the Christchurch killings wrote a hate-filled manifesto in which he said he was influenced by far-right ideologues including Breivik.

Breivik detonated a massive bomb in Oslo that killed eight people and then opened fire on a gathering of the Labour Party's youth wing on the island of Utoya, killing another 69 people, most of them teenagers.

Local Norwegian paper Budstikka said it had contacted the mosque in Baerum in March after the Christchurch massacre and that officials there had said security would be tightened.