The victim, a 58-year-old man named locally as surgeon Dr Nasser Kurdy, was taken to hospital with a stab wound to his neck following the assault outside the Altrincham Islamic Centre, in Grove Lane, in the Greater Manchester market town on Sunday evening.
He has been discharged from hospital, according to his colleague Dr Khalid Anis, a spokesman for the Altrincham & Hale Muslim Association, who said he was "very lucky".
Greater Manchester Police said two men, aged 32 and 54, were arrested within an hour of the attack, which the force is treating as a hate crime but not terrorism related.
Assistant Chief Constable Russ Jackson said: "'This is a very nasty and unprovoked attack against a much-loved local man."
Police are not looking for any other suspects, he added.
Dr Anis, who was with his friend moments after the attack, said: "It could have been very, very serious.
"He said he noticed someone cross the road and then somebody just attacked him from behind.
"There were definitely abusive comments made - obviously he was in shock at the time, he had just been stabbed so the detail of those comments I don't know but there were definitely abusive comments made by the attackers at the door of the mosque.
"We understand it was a knife - he is very lucky.
"It's obviously out of the blue, it's shocked the whole community.
"It's not just a criminal act against the Muslim community or one individual, it's the people living in Altrincham, I think we all feel that.
"The fact they attacked an orthopaedic consultant who devoted his life to helping others is really quite poignant."
Other Muslim leaders condemned the attack.
Harun Khan, secretary general of the MCB, said on Sunday: "We are shocked to hear of the stabbing of a prominent Muslim surgeon outside Altrincham Mosque today in what the Greater Manchester Police have described as a hate crime.
"We are relieved to hear that the victim's injuries are not currently critical.
"Our prayers are with the victim, his family and the local community."
He called on the Prime Minister and Home Secretary to implement the Government's Hate Crime Action Plan.
Mohammed Shafiq, chief executive of the Ramadhan Foundation, tweeted: "I strongly condemn the stabbing of the Imam of the #Altrincham mosque earlier today. The Imam is recovering and an arrest has been made."
A video posted on Facebook following reports of the stabbing purportedly shows the victim immediately after the attack.
A man is filmed sitting on a bench clutching at his neck and appears to be in some pain as people attend to him.
Manchester Central Mosque said in a statement on Facebook the victim is a consultant orthopaedic surgeon at Wythenshawe Hospital, and occasionally does the sermon at Friday prayers.