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 in Baerum, 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 Saturday afternoon's 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.

A police expert walks past a robot in front of the al-Noor Islamic Centre, a day after a gunman was overpowered at the mosque in the town of Baerum, an Oslo suburb. (Terje Pedersen/AFP/Getty Images)

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 spokesperson Waheed Ahmed told Reuters on Saturday.

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.