LONDON — A man accused of killing an off-duty British soldier in a frenzied knife and cleaver attack on a London street defended his actions in court Monday, claiming he is a soldier fighting for the Muslim religion and declaring his love for al Qaeda.

Michael Adebolajo, 28, said he attacked soldier Lee Rigby because he wanted to protest Britain’s invasion of Muslim lands. He claimed to be one of many fighters engaged in jihad, or holy war, against Western countries that wage war in the Middle East and Afghanistan.

When asked what his defense was, Adebolajo answered that he was a “soldier of Allah” and said he had no regrets for his actions.

“I will never regret obeying the command of Allah,” he said. “I’m a soldier. I can’t do anything else.”

Adebolajo spoke calmly and clearly as he was cross-examined, telling jurors that while he had never met anyone from al Qaeda, he was full of admiration for the terrorist group.

“I love them. I consider them brothers in Islam,” he said.

Adebolajo and fellow defendant Michael Adebowale, 22, are accused of murder in connection with Rigby’s death, a brutal slaying that shocked the country.

Rigby, 25, was walking near his barracks in south London on t May 22 when he was run over by a car, then stabbed and nearly decapitated with a meat cleaver.

The two suspects deny the murder charge, and Monday’s hearing was the jury’s first chance to hear directly from one of the defendants about what led to the attack.

Adebolajo said he was not motivated by any personal grievances against Rigby — rather the plan was just to find any British soldier. He said he made sure that Rigby was a soldier before he killed him, and hoped the death could “indirectly save the lives of many.”

“I was keen that the reason for the death of this man is not misunderstood. I wanted people to understand . . . It only happened for one reason only, and that is foreign policy,” he said.

Adebolajo said he stayed at the scene waiting for police to arrive, then rushed at them because his religion forbade him to run away from the enemy. He denied a charge of trying to kill a cop.