A Mpumalanga magistrate has warned a first-year mechanical engineering student that having sex with a minor has compromised his chances of being employed.

The student, Bongani Sifunda, 24, of Langeloop village south of Malalane, pleaded guilty to a charge of statutory rape when he appeared in the Tonga Regional Court on Thursday afternoon, a Sapa correspondent reported.

He admitted to having sex with his 14-year-old girlfriend on the weekend of January 17.

"Even though you showed remorse when you pleaded guilty, that doesn't mean you will walk home freely. This is a lesson to you; as from now your life will change; it will be difficult for you to get a better job because your name will be put under the sexual offences registry where everyone will read about you," Magistrate Edgar Moletsane told Sifunda.

Moletsane also ordered Sifunda to declare to his future employers that he is a sex offender.

His legal aid lawyer told the court that the two started dating last year.

He said the two had sex when the girl visited Sifunda for an entire weekend at his parents' house.

He pleaded with the court to hand him a light sentence because he had already spent more than a month in jail.

Prosecutor Thulani Msibi told the court that the victim spent the entire weekend at Sifunda's house while knowing she was a minor.

"The victim has to be blamed too in this case. South African law states very clearly that having sex with a person under 16 years is unlawful. I would like you your Worship to give him a minimum sentence because he has learned a lesson; he will tell others that having sex with a minor could land you in jail," Msibi said.

Magistrate Moletsane found Sifunda guilty of statutory rape and sentenced him to four years' imprisonment suspended for three years.

"I am warning you boy not have an affair with or play near minor girls...

You are not allowed to commit a similar offence within the period of three years... [or] you will be arrested again," Moletsane said.