Police in the U.K. charged a 25-year-old man Thursday with murder after he stabbed a British lawmaker to death.

Authorities say that Ali Harbi Ali, a Londoner with Somali heritage, was responsible for the killing of David Amess last week. He has also been charged with “the preparation of terrorist acts” after claiming he is affiliated with the Islamic State.

“We will submit to the court that this murder has a terrorist connection, namely that it had both religious and ideological motivations,” Nick Price of the Crown Prosecution Service said.

“He has also been charged with the preparation of terrorist acts.”

Prosecutor James Cable told the court that Ali, the son of an ex-media adviser to a former prime minister of Somalia, had described himself as affiliated with IS and had planned for years to kill a member of parliament, Reuters noted.

Amess, a member of Prime Minister Boris Johnson's Conservative Party, was meeting with constituents at a Methodist church when he was stabbed to death.

The police arrested Ali on the scene, saying they were “not looking for anyone else in connection with the incident and do not believe there is an ongoing threat to the wider public.”

Amess, 69, was a supporter of Brexit and animal welfare legislation. He was also a leading voice within his party for support of Israel.