LONDON — British security officials confirmed Thursday that both suspects in the hacking death of an off-duty British soldier were known to MI5, the domestic security agency, in the years before the attack, in which men drove their car into the soldier on a busy London street and then chopped at him with cleavers as he lay prone on the sidewalk.

Twenty-four hours after the attack, with Britain still reeling with shock at its sheer brutality, the victim was identified as a 25-year-old army bandsman and machine-gunner, Lee Rigby, who had served in Afghanistan and was the father of a 2-year-old boy. He had left his barracks in plainclothes to visit his mother, the authorities said.

Security officials said the suspects were radicalized British Muslim men with family origins in Nigeria. One was named by the BBC as Michael Adebolajo, 28, who it said had been raised in a Christian family in Romford, east of London. He converted to Islam in about 2001, and joined a radical Muslim group, Al Muhajiroun, that was banned in Britain in 2010 as an Islamic terrorist organization, notorious for having praised those who carried out the Sept. 11 attacks. The other suspect was not identified.

The two suspects in the killing were under police guard in separate London hospitals, where they were being treated for gunshot wounds inflicted by the police when they were arrested, officials said.