A man has walked free from court after pleading guilty to the rape of a 12-year-old girl.

Lady Scott took the “wholly exceptional” decision to grant Daniel Cieslak an absolute discharge at the High Court in Glasgow on Friday.

Cieslak, 21, met the victim and her friend, aged 12 and 13, in a taxi queue in Edinburgh after a night out in the summer of 2015 and went back to a party with them thinking they were 16 and 17, a statement on the Judiciary of Scotland website said.

He was 19 at the time.

Lady Scott said: “You understood from chat in the taxi that the victim was 16 years old and her friend was 17 years old. The taxi driver had the impression that the victim was about 20 years old.

“Once at the flat, after some time, you paired off and you and the victim engaged in sexual intercourse.

“She left the next morning. She had no concerns and there was no suggestion of her being distressed.”

Police officers who had spoken to the victim earlier in the night in relation to another matter also had no concerns over her age, Lady Scott said in her order.

The judge said Cieslak was culpable under “strict liability”, where victims under 13 are deemed by law to be incapable of consent.

But the judge said there were “a number of exceptional circumstances” which applied.

In pictures: St. Patrick's Day around the world Show all 24 1 /24 In pictures: St. Patrick's Day around the world In pictures: St. Patrick's Day around the world Participants take part in the St Patrick's Day parade on the streets of Dublin PA In pictures: St. Patrick's Day around the world Police officers pretend to arrest a man dressed in a leprechaun outfit as he poses for a photograph along the parade route during the St. Patrick's Day parade in Dublin, Ireland Getty Images In pictures: St. Patrick's Day around the world The service and pilgrimage to celebrate Saint Patrick's Day takes place at Saul Church in Downpatrick, Northern Ireland Getty Images In pictures: St. Patrick's Day around the world Racegoer during the Cheltenham Festival Reuters In pictures: St. Patrick's Day around the world The Coca-Cola London Eye, on London's South Bank is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world Prince William, Duke Of Cambridge and Catherine, Duchess of Cambridge take a drink of Guinness as they meet with soldiers of the 1st battalion Irish Guards in their canteen following their St Patricks day parade at Cavalry Barracks in London, England Getty Images In pictures: St. Patrick's Day around the world The Coca-Cola London Eye, on London's South Bank is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world Intu Trafford Centre in Manchester is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world Intu Trafford Centre in Manchester is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world The Kelpies in Falkirk, Scotland, is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world Gateshead Millennium Bridge in Gateshead, Tyne and Wear, is lit green by Tourism Ireland to celebrate St Patrick's Day PA wire In pictures: St. Patrick's Day around the world 4 Times Square, The Bank of America Tower and the Empire State Building have their spires lit green for St. Patrick's day in Manhattan, New York Reuters In pictures: St. Patrick's Day around the world A spectator shows his Irish pride as he watches the annual St. Patrick's Day parade in New York City Getty Images In pictures: St. Patrick's Day around the world Bagpipers march up Fifth Avenue during the St. Patrick's Day Parade in New York AP In pictures: St. Patrick's Day around the world Revellers march up Fifth Avenue during the St. Patrick's Day Parade in New York AP In pictures: St. Patrick's Day around the world The statues of the ducks from the book, 'Make Way For Ducklings,' (R-L) Mrs. Mallard, Jack, Kack, Lack, Mack, Nack, Ouack, Pack, and Quack are decorated for State Patrick's Day in the Boston Public Gardens in Boston, Massachusetts, USA EPA In pictures: St. Patrick's Day around the world Tiernan Irish Dancers put on a show as the Capitol Rotunda is filled with Irish music and a clapping audience during the annual St. Patrick's Day celebration at the State Capitol in Helena, Montana, USA AP In pictures: St. Patrick's Day around the world The Colosseum in Rome, illuminated in green for St. Patrick's Day Getty Images In pictures: St. Patrick's Day around the world The magic fountains of Montjuic have lit up green to celebrate St. Patrick's Day, patron saint of the Irish, in Barcelona, Spain EPA In pictures: St. Patrick's Day around the world The Burgtheater (Imperial Court Teathre) is illuminated with green lights to celebrate St. Patrick's Day in Vienna, Austria Reuters In pictures: St. Patrick's Day around the world The Chain Bridge is illuminated in green in honour of St. Patrick's Day in Budapest, Hungary EPA In pictures: St. Patrick's Day around the world Christ the Redeemer statue is illuminated in green in honor of St. Patrick's Day in Rio de Janeiro, Brazil AP In pictures: St. Patrick's Day around the world Girls perform an Irish dance for customers in the the Mercantile, Australias Longest Running Irish Pub in The Rocks in Sydney on St. Patricks Day Getty Images In pictures: St. Patrick's Day around the world Participants pose for a photo during celebrations of St. Patrick's Day at a hotel in The Rocks in Sydney, Australia EPA

She said: “Although the factual absence of consent is not an ingredient of the offence, it is a material factor for the purposes of sentencing. Here the victim willingly participated in the sexual intercourse and there was, in fact, consent.

“So too, whilst there is no defence to this offence because of strict liability, the fact is that you would have had a defence if the victim had been a few months older.

“The statutory offence for girls aged over 13 to 16 years provides for a defence based on reasonable grounds of belief by the accused that the victim was above the age of consent.

“It is clear from the agreed facts presented to me that the Crown would have been unlikely to, or unable to, exclude such a defence and they do not dispute this. Accordingly, it is very unlikely the Crown could prove a crime had the victim been over 13 years of age.”

Cieslak became distressed when he was told the age of the victim by police officers and has dropped out of a college course, Lady Scott said.

Taking into account that all witnesses on the night thought the victim was over 16, that Cieslak was told she was 16 and with no signs of distress, Lady Scott said: “Your criminal culpability here is wholly restricted to the application of strict liability within this offence.

“That is in marked distinction to other reported cases under this statutory provision, which have involved conduct involving assault or recklessness or force, or the absence of consent or have resulted in distress to the victim – all of which are factors which raise the need for punishment.

“In addition, there is no suggestion here of predatory conduct or grooming or manipulation or deception.

“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.

“Nor do I consider there is any basis for, or real public interest in, requiring your notification under the Sexual Offences Act 2003.

“Considering all of these factors I have reached the conclusion that justice is best served in this case by taking the wholly exceptional decision not to sentence you and instead I discharge you absolutely.

“As a result, the requirement of any notification does not arise under the relevant statutory provisions.”