One of the attackers was killed and another was badly wounded during the assault, army chief Jesus Suarez Chourio said.
Military helicopters could be seen flying over the major northwestern city as tactical armored vehicles patrolled the streets in a climate of tension.
Powerful explosions were heard by a team of AFP journalists.
Locals said a nighttime curfew had been imposed, as flaming barricades set up in the street by anti-government protesters spewed black smoke.
More From This Section
Still, the incident heightened fears that Venezuela's deepening political and economic crisis could explode into greater violence.
The armed forces said in a statement "a group of civilian criminals wearing military uniforms and a first lieutenant who had deserted" carried out the attack, during which a number of weapons were stolen.
The lieutenant and several of the attackers were arrested but "an intense search" was on for the others who made off with the guns, the military said.
The statement said those detained had "confessed" to being hired by "extreme-right activists, in connection with foreign governments." It did not identify those governments.
The opposition, which controls the legislature, has become sidelined. Its leaders are under threat of arrest after organizing protests, fiercely countered by security forces, that have left 125 people dead in the past four months.
One prominent leader, Leopoldo Lopez, was returned to house arrest after being hauled off to military prison four days ago.
The new Constituent Assembly, packed with Maduro allies including the president's wife and son, has quickly used its supreme powers to clamp down on dissent.
On Sunday it announced -- then suspended -- the creation of a "truth commission" sought by Maduro to probe alleged crimes by the opposition.
The United States accuses Maduro of installing an "authoritarian dictatorship" that has turned Venezuela into an international pariah.
The United States, Colombia, Chile, Guatemala, Mexico, Panama and Peru have slammed the "illegal" sacking of Ortega.