A rogue Venezuelan police officer who became a hero of the resistance last year when he stole a helicopter and dropped grenades on the Supreme Court has been killed in a police operation.

While the dramatic gun battle was going on around him, Óscar Pérez – who had been an action film star and portrayed himself as a James Bond or Rambo-like figure on social media – posted several videos to his tens of thousands of followers on Instagram.

A post shared by Oscar Perez (@equilibriogv) on

The clips showed blood dripping across his face as gunshots rang out in the background. "We're wounded ... they're killing us!" said Pérez in one video, seemingly wearing a bulletproof vest as he crouched down. Pérez, 36, had been holed up in the poor hillside neighbourhood of El Junquito with at least two other men.

Pérez said officers were firing at the group and wanted to kill him instead of permitting his surrender. "We're going to turn ourselves in!" he shouted. He urged Venezuelans to fight against the socialist government. "I want to ask Venezuela not to lose heart — fight, take to the streets," he said. "It is time for us to be free, and only you have the power now."

A post shared by Oscar Perez (@equilibriogv) on

In one video, Pérez stared into the camera and told his children he loved them and hoped to see them again. His last video was posted about 10:30 am (0230 GMT). A Reuters witness in the area later saw an ambulance speed by and said gunshots were no longer heard.

Many hours after the shoot-out, officials in Venezuela confirmed that Pérez was among seven killed. A photo posted on Twitter appears to show Perez's dead body lying on the floor of a destroyed house.

In a televised address, President Nicolas Maduro claimed the group was preparing a car bomb to use against an embassy, without giving details.

Pérez shot to fame in June when he staged a dramatic helicopter attack in Caracas, lobbing grenades at the Supreme Court and Interior Ministry buildings in broad daylight. No one was injured in the incidents and Perez managed to flee before authorities swarmed in.

In numerous videos posted on Instagram, Pérez claimed that he was fighting for Venezuela's freedom from a tyrannical government that is starving its people. He amassed tens of thousands of followers online and piqued the curiosity of Venezuelans who either hailed him as hero, condemned him as a criminal.

Adding to the intrigue were Pérez good looks and his unusual past, which combined work as a highly trained officer, an action-movie actor, pilot and dog trainer.

Days after his brazen helicopter attack, Pérez rode into Caracas on a motorcycle and appeared at an anti-government protest. "It's the zero hour," Perez said in a posting last July as several masked youths looked on from behind. "The true way to pay respects to those who've died is for this dictatorship to fall."

In December, Perez posted videos showing him and a small armed band taking over a military outpost and smashing a portrait of Maduro with his foot. Perez and the assailants berated several detained guardsmen for doing nothing to help their fellow citizens suffering from hunger. Maduro responded in the following days, vowing to meet Perez with bullets.