Viceslav Toderici, who is in his 30s, realised he made the wrong decision but thought he was helping out a friend.
Toderici was spotted by gardaí after he drove past them at high speed, and started swerving between traffic on the M50 and M1 motorways.
Judge David McHugh fined Toderici €200, disqualified him from driving for five years and imposed a five-month sentence suspended for two years.
The defendant, of Park View, Swords Manor in Swords, admitted driving without insurance or a driving licence at M50 Blanchardstown on May 16, 2021.
Toderici was charged with dangerous driving, but a plea to the lesser charge of careless driving was accepted.
Blanchardstown District Court heard gardaí were on mobile patrol at 1.55am when they saw a black Mercedes drive past them at speed.
He was serving between traffic on the M50 and M1, Garda Stuart Gleeson said. The garda activated his blue lights and sirens and the defendant came to a stop.
Gda Gleeson asked Toderici to produce his insurance but he failed to do so.
Defence solicitor Aoife McNichol said Toderici worked as a painter and was supporting a wife and child.
On the night, he was out with friends, and to save a friend from driving while under the influence he decided to get behind the wheel, she said.