TEHRAN — In a cross-border strike, Iranian intelligence operatives hunted down and killed the “mastermind” of the terrorist attacks on two landmarks in Tehran last week, a top official said.

The Islamic State claimed responsibility for the attacks at Iran’s Parliament building and the mausoleum of Ayatollah Ruhollah Khomeini, the founder of the Islamic republic, which killed 17 people.

The Iranian official, Mahmoud Alavi, the intelligence minister, speaking on state television late Saturday night, described the man who was killed as “the mastermind and commander of the team” that carried out the assaults.

The suspect, whose name was not revealed, fled the country after the attacks, Mr. Alavi said, and was captured and killed with “the help of intelligence services of allied countries.”