An Australian man has been dealt a $3,000 (£1,700) fine for pretending to be a hospital doctor for more than seven months.

Nicholas Delaney, 25, of Brisbane, used a stolen pass from Ronald McDonald House to walk straight past security every day. He "worked" at Lady Cilento Children's Hospital and was able to keep up the ruse from May until December last year.

He was busted by a security guard when his credentials had to be renewed. Nine News reported that Delaney even attempted to seduce a guard into making him a photo ID badge.

Delaney's lawyer described his client's actions as similar to those in the film about a master of disguise, Catch Me If You Can. But the magistrate said Delaney's situation was closer to that portrayed in The Secret Life of Walter Mitty, in which Ben Stiller plays a loner who is constantly daydreaming about a more exciting life.

Brisbane Magistrates Court heard that Delaney took on the disguise because he wanted friends. He avoided a prison sentence because he did not interact with patients at all.

The case has brought calls for Queensland's public health sector to face scrutiny. Magistrate Barry Cosgrove said: "[It] doesn't encourage public confidence in the system."

Shadow minister for health Ros Bates said: "It's appalling that someone can throw on a set of scrubs, wrap a stethoscope around their neck and wander around any of our hospitals in Queensland."

Cosgrove warned Delaney that a repeat of the offence would land him in jail. "You'll make lots of friends in jail, but not the ones you may want," he warned.

Delaney was recently sacked from his job as a warden at Sunnybank Private Hospital. Reporters approached him for comment as he left the courtroom but he refused to speak. He tried to hide his face with a folder and eventually ran away from the media crews.