CHRISTCHURCH, New Zealand — Prime Minister Jacinda Ardern apologized Tuesday for security lapses that preceded New Zealand's deadliest terrorist attack, as a report found that intelligence officials had focused disproportionately on countering ­Islamist violence rather than threats posed by other extremist ideologies.

Fifty-one worshipers were killed when Brenton Tarrant opened fire on two mosques in Christchurch during Friday prayers on March 15, 2019. Tarrant, an Australian who had posted a white-supremacist manifesto online and live-streamed part of the slaughter on Facebook, was sentenced in August to life in prison without parole.

A high-level inquiry tasked with determining whether anything could have been done to prevent the attacks published its findings on Tuesday. The nearly 800-page report concluded that the gunman acted alone, and that while there were shortcomings in vetting the shooter when he applied for a firearms license, there was little the state could have done to thwart the atrocity.

Nonetheless, security agencies had geared an "inappropriate concentration of resources" toward detecting potential Islamist threats, compared with the dangers posed by white supremacists like Tarrant, the report said.

Ardern acknowledged this and other findings, including that weak firearms regulations allowed the gunman to acquire weapons with ease.

The inquiry "made no findings that these issues would have stopped the attack. But these were both failings nonetheless, and for that I apologize," she said.

Andrew Coster, the police commissioner, agreed that New Zealand's "lax" gun-licensing processes had been open to "easy exploitation."

Ardern tightened gun laws after the massacre, including banning semiautomatic weapons, increasing ownership restrictions and instituting a government buyback of existing firearms. She won praise for demonstrating compassionate leadership in the aftermath of the attacks; her ­center-left government was reelected in a landslide in October.

But New Zealand's Muslim community expressed frustration at the findings about security agencies and the way in which the inquiry was conducted.

Gamal Fouda, an imam at the first mosque targeted by Tarrant, said Tuesday that the revelations about security agencies reflected "institutional prejudice."

The Islamic Women's Council of New Zealand said in a statement that "justice has not been served" because much of the inquiry was conducted in secrecy, "under the guise of confidentiality and national security."

The secrecy provisions include a 30-year embargo on publication of evidence and submissions given by current and former government officials, and permanent suppression of an interview with Tarrant out of concern it could inspire further attacks.

Rebecca Kitteridge, director general of New Zealand's Security Intelligence Service, said she had "reflected deeply" on the views of Muslims who felt they had been targeted for scrutiny by the security agencies.

"I know that some people with whom NZSIS has engaged felt that they were under suspicion or were of security concern when that was not so," she said in a statement. "I also acknowledge the need to ensure that there is an appropriate and adequate focus of resources on the range of threats New Zealand faces."

Extremism remains a live issue in New Zealand. In November, a soldier with access to firearms and alleged ties to a far-right group was charged with espionage; he faces a military judicial process. The same month, police responded to what they called a credible threat of a planned school shooting in Wellington.

The inquiry's report noted that Tarrant claimed he was primarily influenced by videos on YouTube rather than anonymous messaging boards, which have been used to spread far-right ideologies. Ardern said she plans to raise the issue with "the leadership of YouTube."