Two unidentified gunmen opened fire on Peshawar High Court (PHC) judge Justice Ayub Khan's car on Thursday morning while he was on his way to the high court, police said.
The judge and his driver, both of whom suffered injuries were shifted to a private hospital, Superintendent of Police (SP) Wasim Riaz said, adding that the victims were out of danger.
The incident took place in a residential area in Hayatabad's Phase V, SP Riaz said.
Senior Superintendent of Police (SSP) Zahoor Afridi said that a 9mm Kalashnikov had been used by the gunmen, who fled the scene after the attack.
The police have launched a probe and recorded the statements of two eyewitnesses so far, SSP Afridi told the media.
He said that the police were also investigating why a security guard had not been accompanying the injured judge.