KABUL, Afghanistan — Afghanistan’s intelligence agency said Saturday that the country’s special forces had arrested a Taliban operative responsible for two major attacks in Kabul. And in a separate operation, agents apprehended a university professor whom they described as a top recruiter for the Islamic State.

In a statement, the Afghan National Directorate of Security said the Taliban operative, Mohammad Sharif, was the mastermind behind a horrific truck bombing that killed 150 people in Kabul’s diplomatic area in May 2017. He was also accused of planning a suicide bombing last November that killed five employees of a multinational security company.

Officials said Mr. Sharif had studied at a madrasa in Quetta, Pakistan, where the Afghan Taliban leadership is based. He was arrested along with two Taliban members accused of helping in the two attacks, intelligence officials said.

There have been relatively few terrorist attacks in Kabul in recent months, due in part to a major security sweep of the capital by the intelligence agency and the Afghan security forces, backed by American military advisers.