(Recasts with Maduro, details of attack, lawmaker quote)

By Girish Gupta and Alexandra Ulmer

VALENCIA/CARACAS, Venezuela, Aug 6 (Reuters) - Venezuelan authorities quelled an attack on a military base near the city of Valencia by soldiers and armed civilians on Sunday, killing two of them in a dramatic escalation of unrest in the protest-convulsed South American nation.

The pre-dawn raid coincided with a video circulated on social media showing more than a dozen men in military uniform announcing an uprising to restore constitutional order following the creation of a pro-government legislative superbody on Friday, condemned internationally as a power grab by President Nicolas Maduro.

The assault highlighted the growing volatility of the OPEC member state after four months of sustained anti-government protests in which some 120 people have been killed. The opposition has denounced Maduro for dragging Venezuela toward dictatorship and has appealed to the military for help. (http://tmsnrt.rs/2ujuylf)

In his weekly televised show, the unpopular socialist leader condemned the attackers as "mercenaries". He said around 20 armed men had entered the Fort of Paramacay near Valencia, about two hours west of capital Caracas, before dawn, surprising guards and making straight for the weapons cache.

Two of the attackers were killed in a firefight with soldiers, Maduro said. Socialist party officials said eight others were arrested, including at least three from the military, while the remainder made off with weapons.

"Those who escaped are being actively searched for, and we are going to capture them," Maduro said.

In Valencia, hundreds took to the streets to support what at first appeared to be a small military uprising, said resident Carolina Herrera, who like other witnesses reported shots through the night. But hooded protesters were dispelled with tear gas, and the rest of the nation of 30 million people appeared mostly calm.

Last week, Venezuela elected a 545-member legislative superbody that Maduro calls Venezuela's only hope for restoring peace. The opposition calls it a power play aimed at keeping the president in office despite approval ratings battered by a deep recession, high inflation and shortages of food and medicine.

It was a turbulent first weekend for the increasingly fractured nation under the new authority.

In its first move on Saturday, the Constituent Assembly removed Venezuela's dissident chief prosecutor from her post and ordered her to stand trial, confirming opposition fears that it would use its powers to root out critics of the government.

'DELIRIOUS MINDS IN MIAMI'

The crisis has turned attention to the role of the military, with some ordinary soldiers increasingly weary of the popular backlash against their role in suppressing protests.

Sunday's attack was apparently led by Juan Carlos Caguaripano, a former National Guard captain. Authorities published photos purporting to show seven arrested men, some of them with bruises on their faces.

In the video circulating Sunday, a man who identified himself as Caguaripano and flanked by men in military uniforms, called for the immediate formation of a transition government.

"This is not a coup d'etat," added Caguaripano, who was removed from the National Guard in 2014, according to a document seen by Reuters.

"This is a civic and military action to re-establish constitutional order. But more than that, it is to save the country from total destruction."

Sunday's apparent bid to spur a national uprising came six weeks after rogue policeman Oscar Perez attacked key installations in Caracas by helicopter. Perez, who also failed to spark a larger movement, is still in hiding.

Authorities said the attackers were mostly civilians working for U.S.-backed right-wingers who are trying to end nearly two decades of socialism in Venezuela, raising the specter of a further government crackdown on dissent in coming days.

"These attacks, planned by delirious minds in Miami, only strengthen the morale of our armed forces and the Bolivarian people," said Socialist Party official Elias Jaua.

The new assembly, which Maduro says is needed to enshrine socialism more profoundly in the constitution, has the power to dissolve or reconstitute all government bodies. The opposition, which controls Congress, boycotted the election for the new body, saying the rules had been rigged.

The fired prosecutor, Luisa Ortega, had become Maduro's main challenger from within the ruling socialist movement since the start of sustained opposition street protests in April.

Her successor has promised to crack down on the demonstrations but Ortega on Sunday rejected her removal as illegal and said she still considers herself the country's top prosecutor.

ARMED FORCES IN SPOTLIGHT

Oil-rich but economically ailing Venezuela has a long history of instability. Maduro's mentor, the late Hugo Chavez, burst onto the national scene by leading a 1992 coup attempt, for which he served time in jail before winning the presidency six years later.

Venezuelans view the armed forces as the key power broker in their country, and opposition leaders have repeatedly exhorted the military to break with Maduro over what they call his erosion of democracy and brutality toward demonstrators.

The military has played a key role in government since Chavez - himself a former military officer - swept to power in 1999 promising to bring greater equality to Venezuela, home to the world's largest oil reserves.

The top brass continues to publicly profess loyalty to Maduro's government. Critics say juicy government contracts, corruption, and contraband mean many military officials want Maduro to stay in office and fear persecution should the opposition take power.

Discontent is higher among lower-tier officials, who are often sent to control rowdy protests and are paid just a few dozen U.S. dollars a month.

"You can't ask civil society and the military to suffer more hunger, crime, and corruption perpetrated by this repressive government," said opposition lawmaker Carlos Michelangeli.

(Writing by Hugh Bronstein and Alexandra Ulmer; Additional reporting by Corina Pons, Deisy Buitrago and Hugh Bronstein; Editing by Daniel Flynn and Mary Milliken)

Our Standards: The Thomson Reuters Trust Principles.