The Australian man charged with murdering 51 people in two mosques in Christchurch, New Zealand, has suddenly changed his plea to admit all charges at a hastily arranged court appearance.

On 15 March last year, a man dressed in military fatigues and armed with semi-automatic weapons shot dead 51 worshippers at Al Noor and Linwood mosques in inner-city Christchurch. Forty-nine people were also injured in the attacks, which were livestreamed on the internet.

The horrific attack shocked New Zealand and is regarded as the worst massacre in the country’s modern history, as well as the country’s largest ever criminal prosecution.

The man accused of the shootings, Brenton Tarrant, a former gym instructor from Australia, was charged with the murders and had maintained a not-guilty plea throughout. His trial was set down for the 2 June in Christchurch high court.

This has now been called off and he has been convicted of all charges, with sentencing to occur later this year.

On Thursday in a court appearance arranged at short notice, the details of which were known to few, Tarrant had changed his plea, and is now pleading guilty to all charges; 51 of murder, 40 of attempted murder and one charge under the Terrorism Suppression act.

Tarrant did not appear in the courtroom but changed his plea via video link from his Auckland prison cell. It came on the first day New Zealand went into nationwide lockdown in an attempt to control the coronavirus pandemic.

Prime minister Jacinda Ardern said the guilty plea would be a “relief” for families.

“The guilty plea today will provide some relief to the many people whose lives were shattered by what happened on March 15,” Ardern said.

“These guilty pleas and conviction bring accountability for what happened and also save the families who lost loved ones, those who were injured, and other witnesses, the ordeal of a trial.

The change of plea came as a shock for Kiwis, most of whom were in lockdown in their own homes, police commissioner Mike Bush said.

“Arrangements for the court hearing were made at short notice after the defendant indicated, via his counsel on Tuesday afternoon, that he wished to be brought before the court,” Bush said in a statement.

“Police appreciate this news will come as a surprise to the victims and the public, some of whom may have wished to be present in the courtroom.”

Bush said the two imams from Al Noor and Linwood Avenue mosques attended as representatives of the victims, and suppression orders were put in place to allow as many victims as possible to be told of the guilty plea before it was released to the public.

Families of the bereaved and victims who spoke to the Guardian said they had not even known that a hearing for Tarrant was planned for Thursday.

“The news is fresh and I don’t know whether to believe it or not,” said Maysoon Salama. Her son, Atta Elayyan, was killed and her husband was badly injured in the attack. “It’s unbelievable really.” But she was relieved “in a way”, she said.

“There has been a lot emotionally up and down for us,” she said, adding that the gunman had treated the court system “like a game”, further distressing families.

She had not been aware that a hearing was taking place, and said the Muslim community had been preoccupied with the four-week national lockdown that began in New Zealand at midnight to tackle Covid-19.

News media were told of the court appearance on Wednesday but were not told what it would be about, and notice of the hearing came just hours before the Covid-19 lockdown began.

Salama said the bereaved and victims had received a phone call from a lawyer representing them after the hearing, but before the news was made public.

Bush said 15 March had changed New Zealand forever. “I want to acknowledge the victims, their families and the community of Christchurch – the many lives that were changed forever,” Bush said. “They have inspired all of us to be a kind and more tolerant community.”

Sentencing will not take place until it is possible for all victims who wish to attend the hearing to do so, police said, and that will not be possible “for some time” due to the Covid-19 epidemic.

Tarrant has been remanded in custody until 1 May 2020.

• This article was amended on 28 April 2020. An earlier version incorrectly described Tarrant as being armed with “automatic weapons”.