Two former U.S. Green Berets were sentenced by a Venezuelan court Friday to 20 years in prison for their role in a botched attack in May, aimed at toppling President Nicolás Maduro.

Maduro's chief prosecutor announced the surprise decision late Friday night.

"THEY ADMITTED THEIR RESPONSIBILITY FOR THE FACTS," Tarek William Saab announced on Twitter, adding that proceedings will continue against dozens of other defendants accused of assisting in the May 3 raid.

Lawyers for the former Green Berets, Luke Denman and Airan Berry, said they were barred from the secretive jailhouse proceedings Friday night in a violation of their constitutional rights to a defense.

"Operation Gideon" was launched from makeshift training camps in neighboring Colombia in early May and left at least eight rebel soldiers dead while more than 60 more were jailed.

WHO ARE THE AMERICANS BEING HELD AS 'POLITICAL PRISONERS' ABROAD?

Ex-Green Beret Jordan Goudreau, who operated a Florida-based security firm called Silvercorp USA, claimed responsibility for the failed attack and had hired his two former army buddies to prepare a small cadre of deserting Venezuelan soldiers living at the makeshift camps.

Denman and Berry, both decorated former U.S. service members, were found guilty of conspiracy, trafficking in illegal arms and terrorism. But lawyers for the men said the hearing was marred by irregularities.

Alonso Medina Roa said he was hired a month ago by the families of the two Americans but has so far been barred from meeting or speaking with his clients.

This photo released by the Venezuelan Miraflores presidential press office shows what Venezuelan authorities identify as the I.D. cards of former U.S. special forces citizen Airan Berry, right, and Luke Denman, left, in Caracas, Venezuela. 

This photo released by the Venezuelan Miraflores presidential press office shows what Venezuelan authorities identify as the I.D. cards of former U.S. special forces citizen Airan Berry, right, and Luke Denman, left, in Caracas, Venezuela.  (Miraflores Palace presidential press office via AP)

He added that Judge Máximo Marquez never informed him of Friday night's proceedings at the headquarters of the SEBIN police, where the men are being held. They were represented instead by a public defender.

The incident prompted claims that U.S. backed opposition leader Juan Guaidó had authorized Goudreau through a signed agreement to carry out the attack, executed by two of Guaidó's former political advisors in the U.S.

BRITAIN WITHHOLDS GOLD FROM MADURO SAYS IT DOES NOT RECOGNIZE HIM AS VENEZUELA'S PRESIDENT

The U.S. has denied any role in the attack, but Secretary of State Mike Pompeo said Washington would use all possible means to win the men’s freedom.

The case plays out amid hostility between Washington and Caracas. The Trump administration last year threw its support behind opposition leader Guaidó, who has been recognized as Venezuela's legitimate president by 60 nations pledging to oust Maduro.

CLICK HERE TO GET THE FOX NEWS APP

Guaidó blames Maduro for the once-wealthy nation's economic and social collapse, while the socialist leader, who is wanted in the U.S. on narcoterrorism charges, says Washington is using Guaidó to steal the nation's vast oil wealth.

The Associated Press contributed to this report.