A boy who stole a double-decker bus in Dublin and took it for a 30-minute drive before handing himself over to gardaí has been spared a custodial sentence.

Dublin Children's Court heard the 17-year-old boy was missing from a care unit when he stole the bus from outside the Go Ahead Ireland premises in Ballymount on a date in August last year.

A six-month probation bond was imposed.

He pleaded guilty to the bus theft charge when he appeared before Judge Paul Kelly, who had been furnished with a pre-sentence probation report following a period of adjournment.

The court heard that the teenager, who had left his care facility in Cork, managed to get the bus started.

He headed along the Naas Road and went on a drive for about 30 minutes before bringing the bus back.

Defence solicitor Brian Keenan said the teen then "presented himself at Ballyfermot Garda Station".

Charges for driving without a licence or insurance were dropped, and the defence confirmed there was a guilty plea to stealing the bus.

The Director of Public Prosecutions directed that the case should not be sent to a higher court and Judge Kelly accepted jurisdiction.

Garda Padraig McCarthy said the teen made no reply when he charged him over the bus theft and added that the youth had one prior offence for stealing a phone from a supermarket in Co Cork.

Asked if he got away with that offence, the boy replied, "No, I got a previous conviction". He added that he sold the phone. "I was stuck in Cork and trying to get to Dublin," he explained.

The court heard he is now in new accommodation in Dublin and looking to learn a trade.

Earlier, the judge granted the boy legal aid and told him to "stay off the buses other than being a passenger".