Jordan's former counterterrorism chief General Habis Hanayneh has been shot dead outside his home, according to medical and security sources.

Hanayneh was killed around 7pm (16:00 GMT) on Tuesday in the city of Madaba, around 30km southwest of the capital, Amman.

The 56-year-old, also known as Abu Haytham, died from three gunshot wounds to the chest and was pronounced dead on arrival at al-Nadim hospital, doctor Ibrahim Owais told Al Jazeera.

The assailant has been arrested, according to a statement issued by the spokesman of Jordan's public security department.

"The murderer confessed to his crime, saying he had planned it a while ago, believing that Hanayneh was behind his arrest in Russia in 2005, and caused him trouble at his work," the spokesman said in a statement.

A senior Jordanian intelligence officer and a former senior CIA officer who still has ties to Jordan confirmed Hanayneh's death.

The senior Jordanian intelligence officer, who spoke to Al Jazeera on condition of anonymity, said he had known and worked with Hanayneh for decades and that his death "was a tragic loss to Jordan and the counterterrorism community around the world".

A former CIA analyst, who had worked with Hanayneh in the past and did not wish to be identified for this report, told Al Jazeera that Hanayneh was an "extremely smart intelligence officer" and that he "really understood the underpinning of why individuals join extremist groups".

Hanayneh retired from Jordan's General Directorate of Intelligence (GID) "about a year ago", said the senior Jordanian intelligence officer.

This is the first time in recent memory where a high-ranking Jordanian intelligence officer was killed either on active duty or in retirement.