Security cameras captured the horrific moment a gunfight broke out in an elevator in Brazil on New Year’s Eve, leaving an off-duty cop injured.

The commotion allegedly occurred between three Sao Paulo plain clothes municipal police officers and a tourist in an apartment block in Praia Grande, a beach resort.

The images show a fist fight erupting between the four men with two firing weapons at each other in the confined space.

Amazingly, only one person was injured in the mayhem despite shots being fired at close range.

A 34-year-old municipal guard was hit in his right thigh and is recovering in hospital.

A 21-year-old man was arrested and released without charge on the grounds the images of the shooting were ‘confusing and not conclusive' about who was responsible.

According to investigators the civilian grabbed the policeman’s weapon when it fell to the ground and exchanged shots with another plain clothes officer who fired from outside the lift.

In the security footage two off-duty officers are recorded around midnight travelling down in the lift when the tourist, wearing a red baseball cap, enters with his girlfriend.

Security cameras captured the horrific moment a gunfight broke out in an elevator in Brazil on New Year’s Eve

The lift doors half open and close several times as the group standing outside watch on.

When the doors open for the third time, an argument erupts and the off-duty cop wearing the black t-shirt is allegedly the first to lash out at the young man inside the lift.

All mayhem breaks loose, escalating into a vicious fist fight between the three older men and the younger guy, with the girlfriend getting battered as she is buffeted around in the middle.

The punch-up continues with one of the cops being pummelled to the ground as the other two retreat and the slight-framed girlfriend desperately tries to separate the brawling men.

Mayhem broke loose at the apartment block in the beach resort of Praia Grande as a tourist came to blows with plain clothes police officers

All of a sudden, a gun appears in the boyfriend’s hand. Apparently it had fallen to the ground from the officer’s belt in the confusion. It is normal procedure in Brazil for an officer to carry their weapon even when they are off-duty.

Within seconds the plain clothes officer outside the lift pulls out his weapon and the gun-wielding opponents exchange shots in the tight space.

The boyfriend fires narrowly missing his girlfriend who luckily ducks out of the way in time.

In the shocking altercation, the off-duty cop is hit in the leg and lies injured on the ground.

The images show a fist fight erupting between the four men with two firing weapons at each other in the confined space

A bullet fired into the lift ricochets off the walls, leaving a spray of debris as it hits and misses its target.

The scenes end with the lift door closing, the victim lying bloodied on the ground and the distressed tourist pacing about as the elevator descends.

Detectives called to the scene said they retrieved a .38 calibre pistol. The holiday-maker was arrested and questioned at Praia Grande police station, saying he acted in self-defence.

According to an investigator who watched the security footage, the video does not conclusively prove who the ‘author of the shooting’ is and due to lack of evidence the suspect was released without charges. However, he said the case is still under investigation.

The agent was taken to Irmã Dulce Hospital where he underwent surgery to remove the bullet. His situation is said to be stable with the prospect of a full recovery.