The 29-year-old Australian man who massacred 51 Muslim worshippers at two Christchurch mosques in 2019, changed his plea to guilty Wednesday in an impromptu court hearing he requested.

The suspect pleaded guilty to 51 counts of murder, 40 counts of attempted murder and one count of terrorism via video link as the country prepared to go on a four-week lockdown to try and combat the coronavirus pandemic.

NEW ZEALAND MARKS ANNIVERSARY OF CHRISTCHURCH MOSQUE MASSACRE

The trial, which was scheduled for June, has now been canceled, and a sentencing date has yet to be confirmed. The shooter is facing life imprisonment.

The attack in New Zealand -- the deadliest in the country's history -- happened during Friday prayers and was livestreamed by the gunman on Facebook, where it was viewed 4,000 times before authorities were finally able to take it off the web.

Following the massacre, lawmakers banned semi-automatic weapons.

The imams of both the mosques attacked were among 17 people allowed to attend Wednesday's hearings due to new restrictions on gatherings in small spaces due to coronavirus.

CLICK HERE FOR THE FOX NEWS APP

The Associated Press contributed to this report.