A man who admitted raping a 12-year-old girl has walked free from court.
Daniel Cieslak, 21, had believed the girl - who he met in a taxi queue in Edinburgh in July 2015 - was 16. He burst into tears when police later revealed her true age.
The judge, Lady Scott, said she was taking the "wholly exceptional decision" not to sentence Cieslak.
Instead, she gave the first offender an absolute discharge at the High Court in Glasgow.
She said: "I do not consider there is any need for, or public interest in, punishment. To do so would in my view be disproportionate given the nature of the criminal culpability here."
Student Cieslak, who was 19 at the time of the offence, had earlier pleaded guilty to the rape charge.
The court heard that the girl had travelled to Edinburgh on a Friday in July with her 13-year-old friend, where they met more friends and bought vodka.
In the early hours of the following morning, police searching for another girl who was missing spoke to the 12-year-old in Princes Street.
Prosecutor Kath Harper said officers had not noted her details "as they were not concerned by her age".
At about 04:00, the girl and her friend met Cieslak and one of his friends in a taxi queue.
The victim said she was 16 and her friend was 17. The taxi driver later said he thought the girl was 20.
Cieslak then invited them to a party at his friend's house, where he had sex with the 12-year-old.
The court heard she left the next morning, and there had been no suggestion of her being distressed.
The offence came to light days later after the girl told her sister she was "extremely worried" she could be pregnant.
An absolute discharge is given instead of sentencing an offender. It is not a conviction - although it may put before the court if the offender appears again for another offence.
It is used "when the court is of the opinion, having regard to the circumstances, including the nature of the offence and the character of the offender, that it is inexpedient to inflict punishment".
Analysis by BBC Scotland's home affairs correspondent Reevel Alderson
This is a highly unusual case, and the judge has pointed out a number of "exceptional circumstances" in it, as she sought to explain why she passed the most lenient sentence allowed in law.
At its heart is the fact that the girl in question looked over 16 - even the judge accepts that, having viewed CCTV footage. Police officers looking at night for under-age children in the streets of Edinburgh had no concerns about her age. Also, the girl engaged in sex willingly.
So why was Daniel Cieslak prosecuted?
Rape laws, which were strengthened in 2009, do not allow any child under the age of 13 to give informed consent about sexual intercourse. So if it happens, in the eyes of the law, it is rape; there is no defence of consent.
Under the strict definition of the Act, prosecutors were bound to charge Mr Cieslak who, in any case, admitted the offence.
But the judge has exercised her sentencing powers to impose no punishment on him.
That would appear to be an exceptional decision, although the most recent figures show in 2015-16, nine people convicted of rape or attempted rape were sentenced to community payback orders or probation.
Lady Scott told Cieslak that the case was one of "strict liability" as anyone under the age of 13 was deemed to be incapable of giving consent.
This was to both protect young girls from "predatory adult males" and to "protect them from themselves".
However, she said the statutory offence had "a very wide scope" and that there were a number of "exceptional circumstances" in the case.
Lady Scott said there had been consent from the victim.
She added that if the girl, who was 12 years and seven months old at the time of the offence, had been aged 13 then Cieslak would have had a defence to the rape charge.
He could have argued that he had "reasonable grounds" to believe that the victim was above the age of consent.
Lady Scott said there there were a number of "relevant facts", which included that all witnesses had thought the victim was older than 16.
The police officers had no concerns about her age, and having viewed CCTV footage Lady Scott said it would have been "reasonable" to believe the girl was over 16.