A constable was shot dead while running from police after he threatened a man with a gun in Sharpeville, south of Johannesburg, police said on Wednesday.

"Seven members of the Sharpeville police station were on a routine patrol at around 11pm Tuesday. They were approached by a man who was running," said Inspector Aubrey Moopeloa.

The man told the officers he had had an argument with a man who pointed a firearm at him.

When the 28-year-old gunman was approached by police he fled.

Police gave chase and he shot at them.

Police returned fire and the man was shot in the head and in his right hip.

He died on the scene while one of the inspectors giving chase was wounded in his left leg and hand.

It was later discovered the man was a constable from Sebokeng police station.

The inspector was rushed to hospital in a stable condition.

Police were investigating a case of murder and attempted murder, said Moopeloa.