BERLIN -- A far-right extremist in Germany was convicted Thursday and sentenced to life in prison for the murder of a regional politician who had advocated helping refugees -- a brazen killing that shocked the country.

In its verdict against 47-year-old Stephan Ernst, the Frankfurt state court noted the "particular severity" of the crime, meaning that he will likely not be eligible for release after 15 years as is typical under German law, the dpa news agency reported.

During his trial, Ernst admitted to the June 1, 2019 shooting of Walter Luebcke, a member of Chancellor Angela Merkel's party who led the regional administration in the Kassel area of central Germany -- though he gave three different versions of events.

Luebcke was targeted because he had been outspoken in favour of helping refugees. Prosecutors said Ernst had attended a 2015 town hall event where the politician had defended the German government's decision to allow hundreds of thousands of asylum-seekers into the country.

The court found that Ernst "projected xenophobia onto Dr. Luebcke."

Ernst shot Luebcke on the politician's porch and he died hours later.

The German government warned after the Luebcke killing and other attacks -- including one on a synagogue on Yom Kippur, Judaism's holiest day, in October 2019 -- that far-right extremism posed a significant security threat in the country.

An accomplice who prosecutors alleged was with Ernst at the scene of the crime, identified only as Markus H. due to German privacy laws, was convicted of weapons violations and sentenced to 18 months probation.

H. had been charged with being an accessory to murder, but his attorney argued he wasn't involved and he was only found guilty of the lesser charge.

Ernst was cleared of separate charges of stabbing and seriously wounding an Iraqi refugee in 2016. Presiding Judge Thomas Sagebiel said there are circumstances that point to him as the perpetrator, "but no sustainable evidence."

"Today's verdict encourages me and at the same time is a reminder to us all -- we will not let our country be destroyed by right-wing terrorists and their intellectual instigators," said Armin Laschet, the leader of Merkel's Christian Democratic Union party.

Laschet said that "the slaying of Walter Luebcke was not just an abhorrent, inhuman crime against an individual, but an attack on us all." He added that it's important to stand behind other local politicians who are exposed to "personal hostility."