CIUDAD JUAREZ, Mexico (AP) — Surveillance video and police reports Wednesday suggested that a prison where fighting killed 17 people was plagued by weak controls, disorganization and possible corruption, as well as tensions between local authorities and federal police sent into this border city to keep order.

Inmates may have illegally brought a woman, four girls and guns into the prison in violence-plagued Ciudad Juarez, while federal police responding to the violence Tuesday shot at a local police chief visiting the scene.

State prosecutors in northern Chihuahua state said they also are investigating reports that inmates were holding a party despite rules prohibiting such things at the all-male prison before the riot and jail guards may have attended.

Video shown on a local television channel indicated guards may have even allowed the bloodbath to happen. The footage showed hooded, armed inmates talking with guards, who then left the area before inmates grabbed cell keys, opened a door and apparently fired on prisoners inside with a machine pistol and an assault rifle.

Federal security spokesman Alejandro Poire called for changes at the city-run prison.

"Obviously, in the case of Ciudad Juarez there are things that have to be cleared up," he said. "Fundamentally as we have said, security at the state and local jails all across the country has to be reviewed and strengthened and everything has to be done to avoid tragic events like the one we had there" in Juarez.

Local authorities criticized federal police for firing at Juarez Police Chief Julian Leyzaola, a former army lieutenant colonel known for his get-tough attitude on crime.

Federal police had set up a security ring outside the prison to prevent escapes when Leyzaola drove up to the scene and officers fired at his vehicle. Leyzaola wasn't injured, largely because he was in a bulletproof vehicle.

The incident marked the latest outburst of tension between local authorities and federal forces that took over most security duties in the city across from El Paso, Texas, after an upsurge in killings in 2008. Federal police replaced troops in April 2010 amid accusations that soldiers abused their authority.

Ciudad Juarez has been the scene of bloody turf battles between the Juarez and Sinaloa drug cartels as well as the street gangs allied with them.

Homicides in the city of 1.3 million people have fallen about 22 percent so far this year: 1,314 people were slain from January through July 27, compared to 1,696 in the first seven months of 2010. The full-year total of homicides for 2010 was 3,097, making Juarez one of the most violent cities in the world.

It's unclear whether the drop in homicides has been triggered by the presence of federal police, a law enforcement clean-up campaign launched by Leyzaola when he was hired in March or a partial truce between warring drug gangs.

In an interview with Milenio television, Juarez Mayor Hector Murguia defended the city's security situation while announcing that some 5,000 federal police officers sent to help patrol the city will start leaving in September.

Murguia said federal officials decided to withdraw the officers because security in the city is under control. He added that the city has gone through extensive efforts to get rid of officers working for drug cartels.

The mayor, in particular, has had angry confrontations with federal police, whom he has accused of running roughshod over local authorities.

In January, federal officers fatally shot one of Murguia's bodyguards on a city street corner. The mayor claimed the bodyguard had obeyed officers' orders to lay down his weapon.

Leyzaola also painted a picture of trigger-happy federal authorities in his account of Tuesday's incident.

"I saw a federal officer in front of my sport utility vehicle firing at me, and in turning to a side, there was a group of between 10 and 15 federal officers firing at my vehicle," Leyzaola said.

The federal Public Safety Department said in a statement that officers opened fire after Leyzaola refused to stop and identify himself.

"During an operation to prevent an escape of prisoners, he broke through the security cordon and, acting against security protocol, went through a checkpoint without stopping," the statement said. "And for this reason his vehicle was fired upon to make it stop."

Federal police said they also fired at regular police units. Authorities finally regained control of the facility and found 17 people dead, including a woman. Two inmates had gunshot wounds and 72 others lesser injuries.

Copyright 2011 The Associated Press.