RIO DE JANEIRO, May 5 — The increasing boldness and strength of criminal gangs here in Brazil's showcase city is sowing alarm and impatience among the residents, who complain that political rivalries and bickering between the federal and local governments are blocking an effective response.
Heavily armed drug trafficking groups have been a serious problem for years in the squatter slums that offer a haven and a source of recruits. But in the last month the gangs have been attacking government buildings, shopping centers, hotels, buses and even the highways linking the city to the airport, virtually unchallenged, apparently in direct defiance of government authority.
"This city is immersed in an urban guerrilla war, promoted by armed and organized terrorist groups," the Brazilian Federal Police superintendent here, Marcelo Itagiba, warned recently. "They are ready to confront the reaction that is going to be coming from the state."
After a bus carrying 20 police officers was attacked last month because a drug trafficker objected to its presence in territory he controlled, the governor of the state of Rio de Janeiro, Rosinha Matheus, finally acted.
She fired the state public security secretary and replaced him with "the one who is most important to me, my husband," Anthony Garotinho, the former governor.
For Mr. Garotinho, a politician of national stature who is already thinking about a second run for president in 2006, the job has its risks. As the newsmagazine Isto É described the situation, "Either Garotinho does away with the bandits or the bandits do away with Garotinho."
Mr. Garotinho, 43, was elected governor of the state in 1998 and resigned to run in the presidential election last fall. In the first round of voting he finished third among the four principal candidates, with 15 million votes, and helped Ms. Matheus, a political novice, to be elected state governor. Then he helped Luiz Inácio Lula da Silva win more than 80 percent of the vote here in the presidential runoff.
But after Mr. da Silva took office in January, Mr. Garotinho's camp was largely passed over for cabinet and other government posts, and he and his wife have sniped at Mr. da Silva since then. One result has been a notable lack of trust between the governments and of coordination in combating the crime wave.
"Even the walls of police stations know that representatives of the federal government and the state authorities aren't speaking the same language," the columnist Helena Chagas wrote last month in the daily newspaper O Globo. "In the meantime, the level of audacity of organized crime, which readily senses this butting of heads, rises daily."
In February, just before Carnival, Ms. Matheus requested army units to patrol the streets and challenge the drug gangs. Local news reports said she wanted troops to remain indefinitely, but the federal government refused when she would not agree to a series of policy changes.
Since then, the Brazilian press has been filled with reports that the national authorities in the capital, Brasília, are considering a direct federal intervention in the state government.
The Brazilian Constitution permits such a step under certain circumstances, but there would be some strong opposition, and under the law the action would freeze a proposed nationwide tax and social security reform plan.
The police and intelligence officials say much of the violence is the work of the country's most notorious drug trafficker, Luiz Fernando da Costa, nicknamed Fernandinho Beira-Mar, or Little Freddy Seashore.
He was captured in 2001 in Colombia, where he had taken refuge with left-wing guerrillas, and was imprisoned here but exercised authority from his cell until prison conditions were recently made more rigorous for him and other gang bosses.
Brazil does not have a federal prison system, so Mr. da Silva's government temporarily moved Mr. da Costa to São Paulo and then, when the authorities there demanded that he move on, tried to dump him on some of the country's poorest and most remote states. In each case, there were public protests, and the federal government was forced to pay off a small state to put him in a prison.
"The Fernandinho Beira-Mar situation has shown that drug trafficking gangs today are not just a local issue but a problem with national and even international dimensions," said Julita Lemgruber, director of the Institute for the Study of Security and Citizenship and a former police official. "The state of Rio is not going to win this battle, but it can take steps to neutralize this explosive combination of drugs and arms."
"Sheriff Garotinho," as he is now being called, has cautioned the public "not to expect miracles."
He has talked about reorganizing the police forces, which often fight among themselves and have a reputation for being corrupt, inefficient and trigger-happy. He also has applied for federal grants to install cameras on the streets and to improve police training and equipment.
But Mr. Garotinho will need to mend some fences. The federal government's public security coordinator, Luiz Eduardo Soares, held the same post here until Mr. Garotinho unceremoniously fired him on television in March 2000. Mr. Soares had been receiving death threats, and with his official protection withdrawn, he had to seek refuge for a time in the United States.
"We have to look at this situation with some optimism and hope, because we are at a very important crossroads," Dr. Lemgruber said. "Either Garotinho is able to work with the federal government and gets good results, which then equips him to run against Lula again, or he fails and destroys his political future."