No injuries were reported but Mr Maduro said "a social event" had been taking place at the Supreme Court and the attack could have caused "dozens of deaths". One of the grenades failed to detonate, he added.

EPA
Police surrounded the Supreme Court after the grenades were dropped

EPA
President Maduro is facing regular protests against his government

"I have activated the entire armed forces to defend the peace," he said. "Sooner or later, we are going to capture that helicopter and those who carried out this terror attack."

Who flew the helicopter?

The police officer identified himself as Oscar Pérez in video statements posted on the social media platform Instagram.

Appearing in military fatigues and flanked by armed, masked men in uniform, he appealed to Venezuelans to oppose "tyranny".

INSTAGRAM
A police officer identifying himself as Oscar Pérez made a statement on Instagram

"We are a coalition of military employees, policemen and civilians who are looking for balance and are against this criminal government," he said.

"We don't belong to any political tendency or party. We are nationalists, patriots and institutionalists."

He said the "fight" was not against the security forces but "against the impunity of this government. It is against tyranny".

It is not clear how much support, if any, the officer has.

Mr Maduro said the pilot had worked for former Interior and Justice Minister Miguel Rodriguez Torres, but was no longer with him.

Analysis: Will Grant, BBC News, in Mexico

It is generally an exercise in futility trying to predict if some new twist in Venezuela's long-running crisis is a "turning point" for the country.

There have been scores of seemingly decisive moments over the past few months - from the initial decision to strong-arm the national assembly, to the latest death of a teenage protester in Caracas - that quickly faded into the general malaise afflicting the oil-rich nation.

However, the sight of an apparently disaffected member of the security forces dropping grenades on the Supreme Court and allegedly firing on government buildings is extreme, even by Venezuela's standards.

Whether "Oscar Pérez" is indeed part of a coalition of like-minded "military employees, policemen and civilians" or just a rogue policeman is hard to say.

Certainly President Maduro was quick to dub the incident "a terrorist attack" and used it as a reason to "activate" the armed forces to keep the peace.

However, earlier in the day he, too, had thrown down the gauntlet to his opponents. "If the Bolivarian Revolution was at risk," he said, "what we couldn't do with votes, we would do with arms." The opposition in Venezuela took that as an overt threat.

This helicopter incident may also pass quickly, or it may be more serious. Certainly though, the security situation in Venezuela could hardly be worse ahead of a highly controversial election next month over the government's plan to create a new constituent assembly.

Why now?

There have been almost daily anti-government protests in Venezuela for over two months as the country's economic and political crisis worsens.

REUTERS
The Supreme Court in Caracas was the target of the attack

Those opposed to the government say they are determined to keep protests going until fresh elections are called and the government is ousted.

More than 70 people have been killed in protest-related violence since 1 April, according to the chief prosecutor's office.

Could this have been a coup attempt?

Although President Maduro called the incident an attack by "terrorists" seeking a coup it is not clear how much support, if any, the police officer has.

Earlier on Tuesday, Mr Maduro reiterated his allegations that the US was supporting coup attempts against his government and warned President Donald Trump that Venezuela would resist such a move.

On Monday, he announced that five people had been arrested, accused of plotting against him and preparing for a US invasion.

GETTY IMAGES
Hugo Chávez is still a popular figure among supporters of Nicolas Maduro

However, Venezuela certainly has a history of coup attempts:

In 1992, the late Hugo Chávez tried to overthrow the government of President Carlos Andres Pérez. The attempt failed and Chávez was arrested and imprisoned. He would eventually be elected president in 1998

In 2002, Chávez himself survived an attempted coup by rebel military officers

Months later, security officials foiled another attempt by leading political and military opposition figures