Months before he brutally murdered a beloved Catholic priest in France, a teen terrorist persuaded a judge to set him free from jail, claiming he was not an extremist and wanted to turn his life around.

“‘I am a Muslim grounded in the values of mercy and goodness … I am not an extremist,” Adel Kermiche said after serving a French prison stint for trying to join ISIS in Syria.

Kermiche, 19, released in March, was convincing enough that authorities allowed his release, provided he wear an electronic surveillance bracelet on his ankle –which he had on Tuesday when he slit the throat of Rev. Jacques Hamel.

In February, he lamented that he had been hospitalized for acute depression and “other mental problems,” but had aspirations of being a mental-health nurse.

“I want to get my life back, to see my friends, to get married,” he told a psychological review, according to a report leaked to the Le Mond newspaper.

The judge said the teen was “aware of his mistakes” despite his “suicidal thoughts,” and was therefore a good candidate to be reintegrated back into society, the Daily Star reported.

The prosecutor strongly disagreed, saying: “Even if he is asking for a second chance, there’s a very strong chance he will do the same thing if he is released.”

Kermiche was fitted with a monitoring device that permitted him to be out between 8 a.m. and 12:30 p.m., and released on probation with the “supervision and support” of his family in Saint-Etienne-du-Rouvray.

About four months later, he and another jihadist broke into a church near his home and killed Hamel, 85, whom they forced to kneel near the altar.

French officials believe Kermiche’s cohort was Abdel Malik P., a 19-year-old from southeastern France who was previously unknown to police, a judicial source told Reuters. DNA tests were still being carried out to formally identify him.

The two committed the heinous act at 9:40 a.m. Tuesday – during Kermiche’s electronic window of opportunity, officials said.

An 86-year-old woman who was among the hostages said the attackers gave her husband, Guy, a cellphone and ordered him to record Hamel after he was killed.

The attackers then slashed Guy, who played dead to stay alive, his wife, identified only as Jeanine, told RMC radio.

“He (the priest) fell down looking upwards, toward us,” Jeanine said. “The terrorists held me with a revolver at my neck.”

The attackers — who had a gun, knives and fake bombs — then gave a sermon in Arabic at the altar.

One of two nuns who also were held hostage managed to flee and call for help. Police shot the attackers dead as they emerged from the church and charged at them while shouting, “Allahu akbar!”

Authorities later arrested an Algerian-born 17-year-old described as the younger brother of a man who traveled to the Syria-Iraq zone of ISIS carrying Kermiche’s ID.

The attack, for which ISIS claimed responsibility, occurred with France still reeling less than two weeks after Tunisian Mohamed Lahouaiej Bouhlel killed 84 people and wounded over 300 in a Bastille Day truck rampage in Nice.

French President Francois Hollande, meanwhile, presided over a defense council and cabinet meeting in Paris after meeting with Roman Catholic, Muslim and Jewish leaders Wednesday.

The archbishop of Paris, Cardinal Andre Vingt-Trois, called on Catholics to “overcome hatred that comes in their heart” and not to allow ISIS thugs “to set children of the same family upon each other.”

Authorities also came under mounting pressure to explain how Kermiche was released from jail awaiting trial after twice trying to join ISIS in Syria.

Mohammed Karabila, who heads the regional council of Muslim worship for Haute Normandie, said he was “dumbfounded” by the attack.

“How could a person wearing an electronic bracelet carry out an attack. Where are the police?” he said, AFP reported.

Prime Minister Manuel Valls warned that the attack was meant to “set the French people against each other, attack religion in order to start a war of religions.”

Pope Francis said “the world is at war” but argued that religion was not the cause.

“When I speak of war I speak of wars over interests, money, resources, not religion. All religions want peace, it’s the others who want war,” he said.

Despite his peaceful pronouncements, Kermiche, who moved with his family to France from Algeria, was described as a troubled powder keg.

His friends said he was an easily influenced “buffoon” who had been increasingly radicalized and had threatened to attack a church, The Guardian reported.

One teen said that when he heard about the church attack he knew Kermiche was involved.

“I wasn’t surprised. He talked about it all the time. He talked about Islam, the things like this he was going to do,” he said. “He talked about the Qur’an and Mecca and he told me, ‘I’m going to attack a church.’”

The terror attack on the Charlie Hebdo offices in Paris in January 2015 sparked his desire to join ISIS, the Tribune de Genève reported.

Kermiche set off for Syria in March 2015 using his brother’s passport, but was stopped by German authorities and sent back to France, where he was given a conditional parole as he awaited trial, The Guardian reported.

Two months later, he tried to reach Syria again, this time via Turkey, but was stopped again and retuned to France and jailed until March 2016, the Independent reported.

His mother, a professor, said she tried to keep Kermiche from joining the terror group.

“He said that [Muslims] couldn’t exercise their religion peacefully in France,” his mother told The Guardian. “He spoke with words that didn’t belong to him. He was under a spell, like a cult.”

She said authorities refused her request to give Kermiche an electronic bracelet after he tried to get to Syria the first time.

“Fortunately, we managed to catch him in time — twice. If he had made it to Syria, I would have written off my son. I want to know who messed up my kid,” she said.