Former South Australian Liberals leader David Speirs was sentenced on Thursday to a $9000 fine and 37-and-a-half hours of community service for supplying cocaine to two people while he was an MP.
Scottish-born Speirs also lost his bid against having a conviction recorded which could affect his ability to travel internationally and restrict employment opportunities.
Magistrate Brian Nitschke said Speirs should "well have appreciated the criminality and public mischief" of his conduct when he supplied the drug to two men on two separate occasions in August.
Speirs, 40, sat still in the Adelaide Magistrates Court dock with his hands clasped between his knees throughout the 36-minute sentencing.
Mr Nitschke took into account Speirs' unlikeliness to reoffend, remorse and the additional punishment of losing his job and future employment prospects.
Speirs' lawyer had previously told the court he used and supplied friends with cocaine as part of his "escapism" to deal with stress as opposition leader.
But the magistrate highlighted "the need for public denunciation of this type of offending, and the need for general deterrence".
"I accept that these offences were committed by you at a time when you were suffering stress," he said.
"It is certainly no excuse. You have the intelligence and the wherewithal to obtain help without resorting to escapism, to the escapism (of) drugs."
His sentencing took into account the need to protect the safety of the community and for Speirs to be punished and held accountable.
"You have suffered public vilification, humiliation and personal, social and family stress. I accept that there has been a high level of scrutiny and media coverage of your arrest, in charging and the progress of the charges through the court,'' Mr Nitschke said.
"You've had to endure the glare of public attention as a result of these charges, then there's been public interest ... concerning this case and your offending (which) is hardly surprising.
"This is no doubt due to the prominent position you've held at the time of the offending and indeed, the community's expectation of persons who hold such a prominent position."
The former MP, who quit parliament in October, pleaded guilty in March to supplying or administering cocaine to Peter Zubic and Andrew Sampson, both aged 28, at his home, a week after the men met by chance in the beachside suburb of Brighton.
Mr Nitschke said Speirs' offending, which carries a maximum sentence of a $50,000 fine and 10 years' jail, was on the "lower end" of criminality.
Speirs declined to comment as he left court.