Gardaí in Athlone have arrested a 21-year-old man after he drove the wrong way down the Galway to Dublin dual carriageway.
He was being pursued from Roscommon where he was before a sitting of the court.
The man had been given a sentence for an offence but left the building and was pursued by gardaí while he drove to Athlone.
Gardaí say the car he was driving was damaged after he hit a railway crossing along the route.
When he arrived in Athlone he drove up an exit ramp from the Galway to Dublin road and then drove against the traffic in the wrong direction.
Several motorists had to swerve to avoid a collision with him.
It is understood he then turned the car and drove the opposite direction, but was apprehended by gardaí near the Cavan-Ballymahon exit from the motorway.
He was arrested near the Athlone regional sports complex after he took off on foot.
Gardaí say he is now in custody.
Iarnród Éireann says the man struck and drove through the railway crossing at Knockcroghery in Co Roscommon.
The level crossing barrier was smashed in the incident and staff are currently manually operating the crossing until repairs are made.
The train service from Athlone to Westport was not affected and there were no trains on the crossing at the time.