Two men were arrested after robbing a woman and injuring a police officer while resisting arrest in Cambridge, Eastern Cape police said on Thursday.

Captain Stephen Marais said two plain-clothes police officers on routine patrol near the Cambridge train station saw three men rob a woman early on Wednesday morning.

Police gave chase on foot. The three men split into two groups, with one man running across the train tracks in the direction of Cambridge.

A police officer gave chase and cornered him, but was stabbed in the head when he attempted to arrest the man. The policeman shot the man in the leg as they wrestled for his service pistol.

The other officer managed to arrest one of the other two thieves.

The woman's handbag and cellphone were recovered.

The injured man was under police guard in hospital. The officer was treated at St Dominic's hospital and discharged.

A case of robbery and attempted murder was being investigated.

The men would appear in the East London Magistrate's Court on Friday.