At the time, Allan's pre-sentence report said he could cause a "high level of harm" if he offended again.
Allan was released on parole on December 3, 2015, with conditions he would not have any unsupervised contact with under-16s, or with the victim.
Allan has been remanded in custody, and will be sentenced for the February incident on August 10.
Police had been on an unrelated call out at 2am when they stopped to question Allan and another man in the parked car.
When officers thought they saw a cannabis pipe in the vehicle they said they were going to search it and called for back
up.
Allan then produced the pistol and aimed it at one of the officers, prompting police to shoot him in the side of the face.
He was given first aid, before being taken to hospital in an ambulance with minor injuries.