A former Guantanamo detainee who worked for Osama bin Laden has become an al Qaeda leader in Yemen — and is promoting lone-wolf attacks in a new propaganda video released by the ­terror group.

Ibrahim al-Qosi, a k a Sheik Khubayb al Sudani, encourages “individual jihad” in the video released by al Qaeda in the Arabian Peninsula and titled “Guardians of Sharia,” according to a translation by the Middle East Media Research Institute.

“And as the US has waged war on us remotely as a solution to minimize its casualties, we have fought it ­remotely, as well, with individual jihad,” he proclaims.

This marks the first time Qosi — who worked as a cook, driver and bookkeeper for bin Laden — has appeared in a propaganda video since his 2012 release from the Guantanamo Bay detention camp, according to The Long War Journal, a news site that reports on the war on terror.

Qosi was transferred to his native Sudan after his release.

“One of the main reasons the United States was willing to return him to Sudan was the US confidence in the government of Sudan’s program and its confidence that Mr. al-Qosi would not represent any kind of threat to the United States,” his attorney, Paul Reichler, said at the time.

“If they had considered him a threat, they would not have released him.”

In July 2010, Qosi pleaded guilty to conspiring with al Qaeda and providing material support to terrorism. He got a 14-year sentence that was later reduced to two years.

Just a couple of years after his July 2012 release, he joined forces with al Qaeda in the Arab Peninsula and has since become one of its leaders, according to The Long War Journal.

Qosi spent more than a decade working with al Qaeda and bin Laden, first as an accountant for the terror master’s front companies and later as a member of his security detail.

Military prosecutors have accused Qosi of helping bin Laden escape to the Tora Bora mountains of Afghanistan in 2001.

Qosi was captured by Pakistanis in December 2001.