A WA Police recruit has been treated in hospital after accidentally shooting himself in the leg.

Police say the 27-year-old recruit was learning how to use his pistol at the Joondalup Police Academy yesterday when it discharged.

The bullet entered his right upper calf and exited above the ankle.

He was given first aid at the scene and then taken to Joondalup Health Campus before being moved to Fremantle Hospital where he underwent surgery.

He is in a stable condition and both the police internal affairs bureau and WorkSafe are investigating the incident.