Venezuelan police have killed a former police officer who had been on the run after stealing a helicopter and attacking government buildings six months ago, according to officials.

Interior Minister Nestor Reverol confirmed on Twitter on Tuesday that Oscar Perez was killed with six accomplices in a gun battle near the capital, Caracas, on Monday.

Six members of Perez's group, who Reverol called members of a "terrorist cell", were arrested by police.

Two police officers were also killed in the operation.

{articleGUID}

In June 2017, Perez and several unidentified accomplices used a stolen helicopter to launch four grenades at the Supreme Tribunal in Caracas, before shooting at the interior ministry with firearms.

On Monday, an elite Venezuelan police force located Perez and his allies in El Junquito, on the outskirts of Caracas.

During the raid, Perez posted several videos of himself online showing injuries from a clash between him and the authorities.

In some of the Instagram videos, shots can be heard.

"They are firing at us with grenade launchers. We said we are going to surrender, but they do not want to let us surrender. They want to kill us," a bloodied Perez said.

However, Venezuelan authorities said the polices forces came under attack by Perez's group as they were negotiating a surrender, claiming the group tried to detonate a vehicle loaded with explosives.

People in El Junquito took to the streets to show their support of Perez, who became Venezuela's most wanted man after the helicopter attack.

{articleGUID}

Shortly after that incident, Perez declared that he belonged to an uprising of members of the security forces who were fed up with President Nicolas Maduro's administration.

The Venezuelan authorities later issued an arrest warrant in which he was accused of a "terrorist attack".