An Islamic cleric has left Australia after comments he made against homosexuality sparked a government review of his visa, officials said Wednesday.

Farrokh Sekaleshfar, a British citizen, told Australian Broadcasting Corp. at Sydney Airport on Tuesday night that he had decided to leave after discussions with the Muslim community. He said he had not been asked to leave by the Australian government.

Minister for Immigration and Border Protection Peter Dutton said on Wednesday that the cleric left before Dutton's department canceled his visa Tuesday night.

"This individual has decided to leave of his own accord last night which we welcome and it will be very difficult if not impossible for him to return back to our country," Dutton told Radio 5AA.

Sekaleshfar came under investigation over a newspaper report about comments he had made about homosexuality during a lecture at the University of Michigan in 2013.

The Australian newspaper reported that Sekaleshfar said: "Death is the sentence" for gay sex acts in public.

"Out of compassion, let's get rid of them now," he reportedly added.

Sekaleshfar told ABC his comments had been taken out of context. He expressed sympathy for the families of those killed in the Orlando, Florida, gay nightclub and denied his comments could have inspired such a mass shooting.

"No speech, especially when you're not inciting any hatred and it was given three years ago — that would never lead to such a massacre," he said.

"That animal, they are connecting me to him (shooter Omar Mateen). Not at all. He was an ISIS sympathizer, a follower of (Islamic State group leader Abu Bakr al-Bahdadi, these people are criminals," Sekaleshfar said.

Prime Minister Malcolm Turnbull said Wednesday that he would investigate why Sekaleshfar had not been placed on a watch list that would have alerted authorities to his visa application.

"The moment that this man's presence and what he had said was drawn to our attention, the minister (Dutton) and I spoke about it, the minister acted decisively and his visa was revoked," Turnbull told Radio 2GB.

Sekaleshfar arrived in Sydney last Tuesday as a guest speaker of the Imam Husain Islamic Center. Dutton said he had ordered the visa review after becoming aware on Monday of the cleric's presence in Australia.

A gun attack on a gay nightclub in Florida that left 49 dead has focused Australia's current election campaign on the threat posed by Islamic extremists. Australians go to the polls on July 2.

Turnbull said that if his conservative coalition is re-elected, he would propose legislation to ensure that people convicted of terrorism offenses could remain in prison after serving their sentences if a court ruled that they continued to pose a threat to society.

Opposition leader Bill Shorten questioned whether cost cutting in border security had enabled Sekaleshfar to obtain a visa.

"This government has allowed ... a visa to be issued to someone with despicable, abhorrent views of gay hate, of homophobia of the most violent and vile nature," Shorten told reporters. "The government needs to explain how this fellow got in."