A former Royal Marine caused a blast at a block of flats using a hair gel tub stuffed with explosives, a court heard.
Allan Peach detonated the home-made bomb at a tenement in Dundee, blowing a number of doors off their hinges.
Peach set off another device earlier that evening, but no one was hurt during either incident.
The 24-year-old yesterday appeared at the High Court in Glasgow where he admitted culpably and recklessly causing explosions to the risk of others.
First offender Peach – believed latterly to have worked as an electrical contractor at RAF Leuchars – was remanded in custody to be sentenced next month.
Police called his actions horrendous.
The court heard the blasts occurred in Dundee on June 7 this year.
Prosecutor Paul Kearney told how Peach had earlier bought several 1kg bags of explosive substances online.
These were potassium nitrate, as well as aluminium and sulphur powders.
Mr Kearney added: "It had been established that he was actively seeking information on how to manufacture explosive devices."
Around 9pm that evening, Peach threw the first of his bombs into the garden area of a block of flats in Cullen Place, Dundee.
The court heard Peach, wearing a green boiler suit, then went to another tenement in Cullen Place and was allowed entry by a resident.
A man was later heading home when he heard an explosion followed by the sound of smashing glass.