An armed robber led police to a cache of illegal guns after he fled from a raid with a tracking device hidden in a bundle of banknotes.

Alan Robertson, 47, staged a masked raid at a Tesco petrol station in Carluke, South Lanarkshire, armed with a pistol.

After taking cash from the till, an employee handed over other notes which had a concealed electronic tracker.

At the High Court in Edinburgh on Thursday, Robertson admitted robbery and assault at the petrol station on Lanark Road in Carluke on August 16.

Advocate depute Richard Goddard told the court: "Police officers were able to electronically track the device handed over with the notes to the accused's address."

A search of Robertson's home on Glenmavis Crescent, Carluke, found the handgun used in the robbery along with a sawn-off shotgun, a rifle and ammunition.

The pistol, which had its serial number erased, had previously been deactivated but had been brought back into working order and modified to allow a silencer to be used with it.

Robertson also admitted five breaches of firearms legislation, including possession of prohibited weapons and ammunition.

Mr Goddard said Robertson went into the petrol station in the evening when two female workers, aged 19 and 27, were present.

He went to buy milk but as the till was opened he produced the handgun and said: "Gimme the money."

Robertson leaned over the counter and grabbed cash from till before one of the workers handed him a bundle of banknotes that concealed the tracking device.

Robertson later gave police permission to search his house and officers noticed a bundle of £20 notes underneath a cushion.

He told them: "You know what it is" and said the robbery was "a moment of madness".

Robertson said: "It's the first time in my life that I've not had a job and I just feel so depressed."

He claimed he had found a bag containing two guns when he had been out walking in Carluke three or four weeks earlier and took it home.

Robertson admitted: "I went to a filling station and tried to hold up a filling station with an empty gun. Idiot."

Staff found £160 had been taken in the robbery.

Defence counsel Emma Toner said a background report would be required for Robertson ahead of sentencing as he had previously served a jail sentence.

Judge Lord Armstrong deferred sentence on him but warned him the term to be imposed was "likely to be significant".