A raider pointed a BB gun at the head of a taxi driver, then claimed to gardaí it was a practical joke and the driver had overreacted, a court has heard.

During the attempted robbery, Frank Rowan managed to overpower Paul Evans (36), of Moatview Court, Priorswood, and take the firearm off the raider.

Evans repeatedly ran at Mr Rowan and demanded the gun back until the driver struck him on the head with the gun.

Evans continued to run at the victim and a passerby stopped and called gardai.

Evans told the victim he would wait for the gardai and would “do him for assault” when they arrived.

He later told gardai that the driver “couldn’t take a joke” and that he had only pretended to rob him.

A black ski mask was found on him and gardai arrested Evans.

Evans pleaded guilty at Dublin Circuit Criminal Court to attempted robbery at Marigold Ave., Darndale, on November 13, 2016.

He also admitted the unlawful possession of a realistic imitation firearm.

He told gardai that the 6mm air pistol belonged to his son and they used it to shoot cans in their family garden.

The court heard that after getting into the taxi, Evans put the gun an inch from the driver’s head and told him: “Give me your money or I’ll * shoot you”.

Evans repeated this threat and the driver saw Evans pull the slide on the gun and heard the gun click.

Mr Rowan didn’t know if the gun was real or not and he was afraid that he would be shot, Garda Elaine Galley said.

The victim grabbed Evans’ hand and managed to overpower Evans.

Evans kept his finger on the trigger, but the victim felt he was stronger and during a scuffle both men fell out of the taxi.

Mr Rowan then grabbed the gun and stuck Evans, causing a small injury to his forehead.

The court heard Evans has no previous convictions for violent offending. Pieter Le Vert BL, defending, said the attempted robbery was entirely out of character.

Judge Melanie Greally said that Evans continues to minimise the impact of his crime.

She adjourned the case to May 16 next for sentence and remanded Evans in custody to that date.