Ashley Sibery, 39, was ordered to perform 300 hours' community service and placed on supervision by the authorities for two years after admitting giving his wife the deadly drug.
The general practitioner was convicted in September 2012 of giving his partner Sital the class A narcotic at their home in Edinburgh's New Town area.
Loading article content
He watched her lose consciousness and struggle for breath moments after she took the drug. The incident took place after she confronted him about his secret drug habit.
The medic admitted to his wife he had used the lethal narcotic for two months.
She told him she would end their marriage if he did not quit his addiction.
However, despite the ultimatum, Sibery managed to persuade her into taking what was supposed to be his final fix.
He wanted his wife to experience the feeling he got when he took heroin. However, she collapsed and started having difficulty breathing.
The paramedics who attended their home recognised the former accident and emergency medic and managed to save his wife's life.
Sibery was then arrested and confessed his involvement in the potentially lethal incident to Lothian and Borders Police detectives.
Sheriff Elizabeth Jarvie, QC, at Edinburgh Sheriff Court, decided not to send Sibery to prison after hearing how he had successfully completed treatment for his addiction.
She also heard his wife and his colleagues were sticking by Sibery, who is currently suspended from practising medicine by the General Medical Council.
The sheriff added: "I am persuaded that in these particular circumstances, the imposition of a non-custodial sentence is correct and in the public interest.
"I will impose a community payback order on you which will last for two years. You will also be placed on supervision and you will perform 300 hours' community service. I hope this sentence will allow you to utilise your talents within the community."
Earlier this year, Sibery, of Edinburgh, pled guilty to a charge of culpable and reckless conduct.
Depute procurator-fiscal Karon Rollo told the court the incident took place on April 2, 2012, at the couple's home.
Sibery worked in Edinburgh as a GP. He qualified as a medic in 2002 and had once worked in accident and emergency medicine.
Ms Rollo told Sheriff Jarvie the pair had an argument about how Sibery had been behaving in the months leading up to April.
Mrs Sibery was concerned about how her partner had been acting.
The court heard that during an emotional exchange – which took place minutes after they put their three-year-old son to bed – he confessed he been spending £55 a day on cultivating a heroin habit.
The doctor confessed to police officers he had given his wife heroin and he had an addiction problem.
Ms Rollo added: "The accused indicated he had a heroin habit. He confessed to them he had given his wife heroin.
"He told them he wanted to relax her and deal with stress. He told the officers how she slipped into unconsciousness."
Defence solicitor Duncan Batchelor yesterday told the court his client had recently completed a drug treatment programme.
Mr Batchelor revealed Sibery had recently been tested for drugs – the results showed he had not taken any.
The court also heard Sibery had also started to help other addicts who were trying to tackle their problems.
Mr Batchelor added: "He has successfully completed the treatment. He has fully engaged with the treatment.
"He will continue to take steps to avoid returning to his former habit. He remains under the care of a consultant psychiatrist.
"He continues to receive the support of his colleagues and his family.
"The overall picture is a bright and assuring one."
After reading a report about Sibery's character, Sheriff Jarvie decided not to impose a custodial sentence on the doctor.
However, she ordered Sibery to return to court on November 12, 2013, in order for another sheriff to monitor his progress.
She added: "You will reappear in this court next year."