Prisoner pardons in Kenya are processed through recommendations of the Power of Mercy Advisory Committee established under Article 133 of the Constitution.
On Thursday, Prison authorities confirmed that the pair had left Kamiti.
"Yes, the two were legally released from prison using the relevant provisions of the law. Their term was just about to end and they had shown themselves to be of good behavior," George Dianga, prisons communications boss, told The Standard.
During Madaraka Day celebrations on June 1, former President Uhuru Kenyatta announced that he had pardoned 3,908 inmates following recommendations from the mercy committee. It was not immediately clear whether the two featured in this list.
The pair had been initially jailed for life in 2013 for plotting terror attacks against Israeli, American, British and Saudi Arabian interests in Kenya.
On appeal, their sentence was reduced to 15 years and was to run to 2027. They appealed the sentence again in the Court of Appeal and it was quashed. But the prosecution moved to the Supreme Court and overturned their acquittal.
"The Constitution says anybody, any prisoner including foreigners, can petition for power of mercy. The information we have is that the prisoners were legally discharged from the prison and deported from the country ... because they were foreigners," another senior prison official confirmed.
The official, who is not authorised to speak to the press, added: "They petitioned the power of mercy committee. This is the likely one. They petitioned and then they were released from prison."
The official claimed their full-term sentence would not have gone beyond next year minus their appeals or clemency.
In 2016, another pair of Iranian nationals arrived in Nairobi, allegedly on a terror mission. Sayed Nasrollah Ebrahim and Abdolhosein Gholi Safaee were arrested outside the Israeli Embassy in Nairobi, with Iran saying they were lawyers for Mohammad and Mousavi.
The two were later deported in a deal hatched between Kenyan authorities and Iranian government.
In 2018, the pair was moved to a safe facility following what State authorities claimed was a plot to free them. Anti-terrorism officers had claimed the pair were members of Iran's Islamic Revolutionary Guards Corps, an elite arm of the Iranian agencies.
In the same year, some Members of Parliament censured the Iranian ambassador to Kenya for unlawfully lobbying for release of the prisoners.
Two years earlier, Justice Luka Kimaru had reduced their life sentence to 15 years on grounds that the offence they committed was incomplete. They had been arrested in June 2012 and linked to a 15kg stash of military-grade explosives identified as RDX found at the Mombasa golf course. Experts who testified during the trial said the RDX cache was capable of bringing down the Times Tower building in Nairobi.
Stay informed. Subscribe to our newsletter
"I shudder to imagine the amount of damage that could have been seen," Chief Magistrate Kiarie Waweru said, adding that he had sentenced them to life in prison because the "cry of victims of previous terrorist attacks is louder than their pleas for leniency".