An armed attack at a Norwegian mosque on Saturday will be investigated as a possible act of terrorism, police said on Sunday.

The suspected shooter at the al-Noor Islamic Centre near the Norwegian capital — a young, white male carrying several guns — had expressed far-right, anti-immigrant views online, assistant chief of police Rune Skjold told a news conference.

"We're investigating this as an attempt at carrying out an act of terrorism," he said.

The suspect had been apprehended after the attack, in which shots were fired but no one was hurt, with members of the congregation having overpowered him before police arrived.

"These people showed great courage," Skjold added.

Only three people were present in the mosque at the time of the attack, preparing for Sunday's celebration of the Eid-al-Adha festival, mosque spokesman Waheed Ahmed told Reuters on Saturday.

Police and emergency services attend the scene after a shooting inside the al-Noor Islamic center mosque in Baerum outside Oslo, Norway, on Aug. 10, 2019. Fredrik Hagen / AP

The attacker was also suspected of killing one of his own family members, a young woman who was found dead at his home, police said earlier.

The mosque earlier this year implemented extra security measures following the massacre of more than 50 people at two New Zealand mosques by a suspected right-wing extremist.

In 2011, anti-Muslim neo-Nazi Anders Behring Breivik massacred 77 people in Norway’s worst peacetime atrocity, the majority of them teenagers at a youth camp.