Usman Raja, a burly 40-year-old and onetime pioneer of bare-knuckled mixed martial arts fighting, was back for a few rounds of sparring at his home gym in a town south of London. But before stepping into the ring he wanted to talk instead about his new vocation: the rehabilitation of Islamist militants.

“The biggest things these extremists get from it is community,” Mr. Raja said, ticking off the names of the convicted terrorists now working with him. “They treat each other with love and they hate everybody else.”

These are boom times for Mr. Raja’s new line of business. The retreat of the Islamic State from its last Syrian strongholds is raising alarms about militants returning home to Britain and the West, and the British government has enlisted Mr. Raja to work with at least 30 Islamic State returnees. Groups as far-flung as the Los Angeles Police Department and the Combating Terrorism Center at West Point have sought out his advice on how to deal with violent extremists.

That is part of the reason he was back at the gym. “I can’t lose my Spartan warrior reputation,” he said. “That is my legitimacy in the prisons.”