Closed-circuit cameras stare down from lampposts, allowing a heavily armed gang to keep watch over those who dare to enter one of Caracas' most violent slums. At night, the gunmen cover their faces with ski masks and set up checkpoints, brandishing pistols and ordering residents to identify themselves as they enter the neighborhood.

Here in the 23 de Enero slum, several gangs that pledge allegiance to Venezuelan President Hugo Chavez are effectively the law, ruling over fiefdoms where police seldom venture. Chavez has occasionally criticized the groups, but the authorities have largely left them alone, stoking accusations by critics that the government is tolerating an armed wing that could prove dangerous in a critical election year in Venezuela.

One of the biggest gangs calls itself "La Piedrita," or "Little Rock." In its neighborhood turf, murals are painted with slogans such as "For the defense of the revolution, vote for Chavez. La Piedrita." One of the murals depicts Jesus and the Virgin Mary holding assault rifles.

Nearby, young men wearing olive green caps guard the barred gate of an apartment building that the gang uses as a command center. They don't welcome visitors, especially journalists.

"Please leave peacefully," one of the young men said cordially to a team of AP journalists. "From the high-ranking commanders to the low-ranking ones, no one is going to make any statements because you're going to distort the information."

As he spoke, another man pointed a 9-mm pistol at an AP photographer, ordering him and a driver to get off their motorcycle, and then demanding they get back on it and leave.

Some of Chavez's opponents say the government tolerates such groups to use them when convenient to intimidate adversaries, and that it's hard to predict how they would react if opposition presidential candidate Henrique Capriles were to defeat Chavez in the October presidential vote. Also unknown is how the gangs would react if Chavez were to succumb to his nearly yearlong fight with cancer.

What's clear is that the gangs wield serious firepower, toting assault rifles that only security forces are legally permitted to carry in Venezuela.

"These illegally armed groups could at some point use those weapons to commit crimes or to destabilize any government," said Luis Izquiel, who leads a security committee for the opposition. He said if Chavez is defeated and a new government takes over, "the authorities would have to go get those illegal weapons."

Chavez, who is undergoing cancer treatment, is leading in the polls and has warned his opponents not to try to stir up violence. He has said previously that his socialist movement is "peaceful but armed."

Chavez has also created a Bolivarian Militia, named after independence hero Simon Bolivar, with tens of thousands of civilian volunteers who participate in occasional boot camp training led by military officers.

Nearly a dozen armed gangs, however, appear to maintain looser ties to the government while controlling their neighborhoods in slums located less than a mile (1.5 kilometers) from the presidential palace.

Opposition politicians estimate about 300 people belong to armed pro-Chavez gangs, many of them young men. There is no evidence, however, that they have received weapons or training directly from the government as some Chavez opponents suspect.

Armed groups such as the "Tupamaros" and La Piedrita have existed for years in western Caracas, even before Chavez took office in 1999. But since then they have expanded, and new groups have emerged.

In rare public appearances, some leaders of the groups have vowed to zealously back Chavez's socialist movement. Many of the groups call themselves "collectives," and residents say some, such as La Piedrita, carry out service work including running a community kitchen for the poor. But in photos and videos posted on the Internet, gang members also show off weapons including pistols, AK-47s and R-15 rifles.

Members of La Piedrita have also held menacing protests at the offices of opposition newspapers and anti-Chavez television channel Globovision, hurling tear gas canisters at the buildings. Chavez has publicly disavowed the group in recent years, and in 2009 urged the authorities to detain La Piedrita's leader, Valentin Santana.

Despite arrest warrants for homicide and other crimes, Santana remains free, and it's unclear why he hasn't been captured. Earlier this year, Santana even appeared on state television at a church event.

Wearing a camouflage cap with the bill turned up, he questioned the commitment of some government officials to socialist ideals and pledged "loyalty to our friend Chavez."

Miguel Dao, a former police chief, criticized the authorities' failure to act against such groups. "If you have the power and ... you don't do anything, you become an accomplice of these groups," he said.

Dao said he doesn't think the gangs would represent a major security risk if Chavez were to be forced from office either by illness or electoral defeat. But for now, he said, "I think these irregular groups are better armed than the police."

The Justice Ministry did not respond to requests to ask Minister Tareck El Aissami about the government's stance toward the pro-Chavez groups and the actions that authorities have taken in Santana's case.

During the first half of his presidency, Chavez had publicly praised Lina Ron, a radical supporter with bleached blond hair who led one armed group.

When Chavez was briefly ousted in a 2002 coup, Ron and others took to the streets in protests that helped usher his return to the presidency. In subsequent years, armed gangs of "Chavistas" on motorcycles regularly circled opposition protests brandishing weapons and displaying the flags of their groups. Sometimes, they were spotted firing shots in the air for intimidation.

Such incidents had become less frequent in the past few years, and by the time Ron died in 2011, Chavez had distanced himself from her brash tactics, which included the protests outside opposition news media buildings.

But on March 4, gunfire erupted during an event where Chavez's rival Capriles was visiting the traditionally pro-government neighborhood of Cotiza. Both political camps traded blame for the violence, in which one Capriles supporter was wounded. Members of the opposition said they saw some Chavez supporters with guns. No arrests have been made.

In January, La Piedrita found itself at the center of a national controversy when photos circulated on the Internet showing children posing with assault rifles at a ceremony organized by the group. After a public outcry, Chavez condemned the group and demanded the authorities take action.

"This hurts the revolution," Chavez said.

Prosecutors responded by ordering two women to appear in court as suspects for posing the children with guns. Venezuelan law calls for prison terms of one to five years for adults who provide weapons to children.

The authorities also arrested three members of La Piedrita as suspects in the killing of a bodyguard who had been working for the Justice Ministry.

Criminologist Fermin Marmol Garcia said police and other security forces typically don't enter 23 de Enero without notifying the armed groups. He said that shows the thugs effectively run a "micro-state" and operate like paramilitary groups, controlling their turf.

People who live in the slum have learned to cope with the pro-Chavez gunmen, some of whom claim to keep the neighborhoods safe from common criminals.

"After 10, 11 at night, you can't be in the area of 23 de Enero because there are times when they put up checkpoints and stop cars," said Manuel Mir, a community leader who has lived in the neighborhood all of his life. "They order anyone who isn't from the area to get out. They're masked and armed people. It's unacceptable that groups of this sort are guaranteeing us security."