A motorist whose dangerous overtaking near Penrhyndeudraeth had been filmed on a dashcam has received a six-month suspended jail term after footage was posted on YouTube.

Judge Niclas Parry told 58-year-old Philip Wearing, of Macclesfield, Cheshire: ”But for the grace of God you could have killed the occupants of one car and at least one motorcyclist.

“That was an appalling piece of driving where you, towing a trailer, squeezed in between traffic in your carriageway and oncoming traffic.

Viewing that DVD made one gasp. Mercifully, there was no collision.”

Wearing was ordered to do 150 hours unpaid work and banned from driving for a year with an extended test. He must pay £1,000 costs.

Judge Parry added to Wearing, who pleaded guilty to dangerous driving in a Land Rover Discovery on the A487 on 20 September 2015: ”You have clearly acted out of character. You are a hard-working man with a clean driving licence.”

The clip of two incidents, lasting seconds, was shown at Caernarfon Crown Court.

Prosecutor Richard Edwards said the overtaking occurred at a bend on the Penrhyndeudraeth to Maentwrog road. Three motorbikes were approaching in the opposite direction.

Wearing told police he didn’t think the bikers would have been alarmed or put in any danger, Mr Edwards added.

Gwyn Lewis, defending, said: ”No other road user made any complaint either at the time or subsequently.”

Mr Lewis said the offence would have “enormous” consequences for Wearing, who had a cleaning business.

The lawyer said his client had used the road for 27 years. He had a caravan at Llanbedrog, near Pwllheli.