Iran's comments follow a row over a vigil the UK ambassador attended for those killed in last week's downing of a Ukrainian plane.
Iran's judiciary said on Tuesday that Britain's ambassador to Tehran was an "undesirable element," state media reported after Iranian officials accused him of attending an illegal protest despite his denials.
Iran's Foreign Ministry, which summoned him, would be responsible for announcing any move to expel Rob Macaire, who has been in the post since 2018. Macaire was briefly detained on Saturday.
"Based on international regulations, the British ambassador in Iran is an undesirable element," judiciary spokesman Gholam Hossein Esmaili told reporters when asked about the British envoy.
His remarks were carried on state TV.
A prominent hardline Iranian cleric also said expelling the ambassador would be "the best thing that can happen to him" as, otherwise, loyal supporters of a general killed in a US drone strike would "chop him to small pieces," Ayatollah Ahmad Alamolhoda said, in remarks carried by Eslahat new website.
Alamolhoda is the leader of Friday prayers in the eastern Shia Muslim holy city of Mashhad.
Iranian officials said Macaire was held because he attended an illegal demonstration, which took place amid public anger over Iran's belated admission that its military shot down a passenger plane.
The ambassador said he had attended a vigil for victims of the crash. London said his detention was a violation of diplomat conventions.