It will be legal to own one of the dogs, but they must be muzzled and on a lead in public from that date. Selling or exchanging them will be banned.

And from 31 July it will be an offence to own an XL bully without an exemption certificate. The regulations mirror those in England and Wales but certificates will now be required there.

Community Safety Minister Siobhian Brown urged owners to prepare for the first stage of the new legislation coming into effect. She said: "These new rules are intended to prevent risks to public safety and animal welfare and keep our communities safe.

"The second stage of legal safeguards will provide owners seeking an exemption an appropriate length of time to decide how to prepare for the forthcoming change in the law ahead of the 31 July deadline." Ms Brown added that the vast majority of dog owners were "responsible animal lovers".

Penalties for breaching the new safeguards are up to six months imprisonment and or a fine up to £5,000. The minister outlined the restrictions in a letter to Holyrood's criminal justice committee.

Due to rising concerns over attacks and even deaths, the breed was initially banned by the UK government in England and Wales. The Scottish government followed suit after an increasing number of the animals were being rehomed in the country from across the border, creating what First Minister Humza Yousaf described as a "flow" of the dogs.

Earlier last month Mr Yousaf said the decision was made to "ensure public safety". But the RSPCA has warned thousands of owners could breach new laws banning the dogs.

Jamie Greene, the Scottish Conservative MSP, said the SNP's "failure to act swiftly" had created an influx of the dogs in Scotland. He added: "The SNP were repeatedly warned of the consequences in delaying this sensible ban and unfortunately their embarrassing u-turn has come far later than it should have."

Owners registering to keep their XL bully must comply with restrictions to ensure they are not a danger to the public, including being microchipped, kept on a lead, muzzled in public and neutered to ensure they cannot continue breeding. Further details regarding what date applications for an exemption certificate will open in Scotland, how to apply and available support will be announced over the coming weeks.