A Venezuelan police helicopter strafed the Supreme Court and a government ministry on Tuesday, escalating the OPEC nation's political crisis in what President Nicolas Maduro called an attack by 'terrorists' seeking a coup.
The aircraft fired 15 shots at the Interior Ministry, where scores of people were at a social event, and dropped four grenades on the court, where judges were meeting, officials said.
However, there were no reports of injuries.
"Sooner rather than later, we are going to capture the helicopter and those behind this armed terrorist attack against the institutions of the country," Mr Maduro said.
"They could have caused dozens of deaths," he said.
The 54-year-old socialist leader has faced three months of protests from opposition leaders who decry him as a dictator who has wrecked a once-prosperous economy. There has been growing dissent too from within government and the security forces.
At least 75 people have died, and hundreds more been injured and arrested, in the anti-government unrest since April.
Demonstrators are demanding general elections, measures to alleviate a brutal economic crisis, freedom for hundreds of jailed opposition activists, and independence for the opposition-controlled National Assembly legislature.
Mr Maduro says they are seeking a coup against him with the encouragement of a US government eager to gain control of Venezuela's oil reserves, the largest in the world.
Venezuela's government said in a communique the helicopter was stolen by investigative who declared himself in rebellion against Mr Maduro.
Images shared on social and local media appear to show Mr Perez waving a banner from the helicopter reading "Liberty", and the number "350" in large letters.
The number refers to the constitutional article allowing people the right to oppose an undemocratic government.
A video posted on Mr Perez' Instagram account around the same time showed him standing in front of several hooded armed men, saying an operation was underway to restore democracy.
Mr Perez said in the video he represented a coalition of military, police and civilian officials opposed to the "criminal" government, urged Mr Maduro's resignation and called for general elections. "This fight is ... against the vile government. Against tyranny," he said.
Local media also linked Mr Perez to a 2015 action film, Suspended Death, which he co-produced and starred in as an intelligence agent rescuing a kidnapped businessman.
On Tuesday, witnesses reported hearing several detonations in downtown Caracas, where the pro-Maduro Supreme Court, the presidential palace and other key government buildings are located.
Opponents to Mr Maduro view the Interior Ministry as a bastion of repression and also hate the Supreme Court for its string of rulings bolstering the president's power and undermining the opposition-controlled legislature.
Opposition leaders have long been calling on Venezuela's security forces to stop obeying Mr Maduro.
However, there was also some speculation among opposition supporters on social media that the attack could have been staged to justify repression or cover up drama at Venezuela's National Assembly, where two dozen lawmakers said they were being besieged by pro-government gangs.
Earlier on Tuesday, Mr Maduro warned that he and supporters would take up arms if his socialist government was violently overthrown by opponents.
"If Venezuela was plunged into chaos and violence and the Bolivarian Revolution destroyed, we would go to combat. We would never give up, and what couldn't be done with votes, we would do with arms, we would liberate the fatherland with arms," he said.
Mr Maduro, who replaced Hugo Chavez in 2013, is pushing a July 30 vote for a special super-body called a Constituent Assembly, which could rewrite the national charter and supersede other institutions such as the opposition-controlled congress.
He has touted the assembly as the only way to bring peace to Venezuela. But opponents, who want to bring forward the next presidential election scheduled for late 2018, say it is a sham poll designed purely to keep the socialists in power.
They are boycotting the vote, and protesting daily on the streets to try and have it stopped.
Maduro said the "destruction" of Venezuela would lead to a huge refugee wave dwarfing the Mediterranean migrant crisis.
"Listen, President Donald Trump," he said earlier on Tuesday. "You would have to build 20 walls in the sea, a wall from Mississippi to Florida, from Florida to New York, it would be crazy ... You have the responsibility: stop the madness of the violent Venezuelan right wing."
Opposition to the July 30 vote has come not just from Venezuelan opposition parties but also from the chief state prosecutor Luisa Ortega and one-time government heavyweights such as former intelligence service boss Miguel Rodriguez.
Mr Rodriguez criticized Mr Maduro for not holding a referendum before the Constituent Assembly election, as his predecessor Mr Chavez had done in 1999.
"This is a country without government, this is chaos," he told a news conference on Tuesday. "The people are left out ... They (the government) are seeking solutions outside the constitution." The government said pilot Perez was linked to Rodriguez. Neither men, nor representatives for them, could be reached immediately to comment on the accusations.