New Zealand will hold an inquiry into the massacre of 50 people at two Christchurch mosques, the country’s prime minister said.

The investigation will look into what roles semi-automatic guns, social media and intelligence agencies had preceding the attacks earlier this month.

Jacinda Ardern said the country would hold a Royal Commission of Inquiry, New Zealand’s highest form of investigation.

New Zealand Mosque Shooting
People gather for a vigil in Hagley Park following the mass shooting (Mark Baker/AP)

“While New Zealanders and Muslim communities around the world are both grieving and showing compassion for one another, they are also quite rightly asking questions on how this terror attack was able to happen here,” she said.

Her Cabinet had previously agreed on holding an inquiry, but had not decided what level of investigation.

She said royal commissions are usually reserved for matters of the gravest public importance and that was clearly appropriate in this case.

The exact terms of the inquiry, including its duration, would be finalised over the next two weeks.

“In short, the inquiry will look at what could have or should have been done to prevent the attack,” Ms Ardern said.

“It will inquire into the individual and his activities before the terrorist attack, including, of course, a look at agencies.”

A royal commission is run independently from the government and is chaired by a high court judge.

It has the power to compel witnesses to testify and organisations to hand over documents but it remains up to the courts or government to follow through on any recommendations or findings.

Australian white supremacist Brenton Tarrant, 28, has been charged with murder for the March 15 attacks.

He is next due in court on April 5.

Some people have already criticised New Zealand’s intelligence agencies for focusing too much on perceived threats from Muslim extremists and left-wing radicals but too little on the possible threats from nationalist groups and white supremacists.

“There will be a focus on whether our intelligence community was concentrating its resources appropriately and whether there were any reports that could, or should, have alerted them to this attack,” Ms Ardern said.

“It is important that no stone is left unturned to get to the bottom of how this act of terrorism occurred and what, if any, opportunities we had to stop it.”