A man was caught on camera masturbating close to a woman doing squats in a gym in South Africa. After the video went viral, the gym in Stellenbosch, a university town in Western Cape, banned the man from entering the premises for life.

In the footage, the man could be seen on an exercise mat very close to a woman who was doing weighted squats, the Daily Mail reported, posting screenshots of the video. While he uses his phone with his right hand, he appears to be moving his other hand vigorously in his shorts with a towel over his lap.

The man performing the sex act was filmed by another gym-goer while sitting on an exercise bike and then posted it on social media.

"I want this man's face to go viral. This was at the Virgin Active in Stellenbosch @virginactiveSA. Absolutely abysmal behaviour," the man captioned the video.

Local media reported the Virgin Active branch responded to the incident by taking immediate action against the man for his "depraved behavior" and his membership was reportedly terminated. The gym is now taking legal action against the man, whose membership has been canceled, according to South African media site News 24.

"Virgin Active is aware of a video circulating on social media and WhatsApp," a spokesman for the gym said. "Our clubs are shared spaces and we will absolutely not tolerate depraved behaviour... We commenced our investigation as soon as we received the video. We have identified the member in question and have terminated his membership with immediate effect."

However, it was unclear if the video was reported to the police.

gym_0
This is a representational image. Reuters

Social media users reacted to the incident, with one person writing: "Guys I don't feel comfortable about a man masturbatig in a public space. I don't think it is funny. I have nieces......this #virginactive story is FAR from funny for me. The space is unsafe for women."

Another wrote: "The #virginactive pervert is a sexual predator & some men are actually out here defending him. If he cant control his urges in public just imagine what other despicable acts he's capable of. These are the type of men that grab little kids in bathrooms but carry on laughing mxm."