The shooting of Robin Ahrens, the first female FBI agent to die in the line of duty, occurred during an arrest in Phoenix seconds after another agent struggled with a robbery suspect and was almost shot with his own weapon, the FBI said yesterday.

One of the two FBI agents who Phoenix police said fired at Ahrens as she appeared in a dimly lit passageway with her gun drawn was a rookie who had been with the agency for less than a year, according to sources familiar with the investigation.

Ahrens, a 33-year-old former Culpeper, Va., teacher, had been on active duty for less than three months herself Friday when she and about 11 other agents converged on a Phoenix apartment complex to arrest a man described by the FBI as "a red-hot fugitive -- armed and extremely dangerous."

Phoenix Police Chief Ruben Ortega said Sunday that two FBI agents opened fired on Ahrens. He said they may have mistaken her for the suspect's girlfriend, which a police spokesman yesterday said may have been inaccurate.

"They saw a person with a gun and mistook her. I don't know what was going on in the agents' minds," said spokesman Brad Thiss.

Thiss said police investigators had nothing to substantiate criminal charges against anyone in the fatal shooting of the agent and referred other inquiries to the FBI.

Herb Hawkins, special agent in charge of the FBI's Phoenix office, refused to comment yesterday on any aspect of Ahrens' death, saying, "It would not be prudent."

He said John Glover, the FBI's assistant director in charge of inspections, and a team from Washington were conducting an inquiry that he hoped would be completed by tomorrow.

Hawkins and documents filed in the case provide details of what occurred in the moments before Ahrens was shot, as agents attempted to arrest Kenneth Don Barrett, a suspect in a Las Vegas robbery last month.

According to Hawkins, Barrett, who had been visiting a couple at the complex, went outside and agent Bruce Atkins told him he was under arrest. Barrett started to struggle, then grabbed Atkins' weapon with both hands.

According to an affidavit filed in federal court in Phoenix, "As Barrett had both hands on the gun, he started turning the barrel of the weapon toward Atkins' stomach, and both were struggling with the weapon."

"The gun went off into the ground," Hawkins said, and Barrett broke free, ran several steps and was subdued by several agents. At that point Ahrens appeared, he said. "She came upon the scene at the time they were on the ground subduing and handcuffing Barrett, and that's all I can tell you."

Ortega said Sunday he decided to release an account of the incident after FBI officials refused to disclose any details.

Police findings will be turned over to Maricopa County Attorney Tom Collins, whose office conducts an inquiry into any shooting involving a law enforcement officer, according to a spokesman for Collins.

Sources familiar with the investigation said authorities are still trying to clarify much of what happened, including whose bullets actually hit Ahrens, and are conducting ballistics tests. Police said she was struck at least once each in the face and right arm.

The manager of the Silver Creek apartment complex, where the shooting occurred, said at least six bullet holes were found in the wall near where Ahrens was standing.

Sources familiar with the investigation said there are slight variations in what agents recall about the shooting. "It's not that anybody is concealing anything," one source said. "There are just different recollections. Was there a warning? Who shot first? What did you see? Where was she standing?" The source said there is no indication that Ahrens fired her weapon.

Funeral services are scheduled for Wednesday in Hudson, Wis., where Ahrens grew up. Friends and family said she was adventurous, athletic and always ready for a new challenge. William Pearson, principal of Culpeper County High School, where Ahrens worked for four years starting in 1980, said she told him about two years ago that she had applied to the FBI.

"But it wouldn't have surprised me if she came in and said, 'Look Bill, I'm going to try out for the Redskins,' " said Pearson. "She was game, always willing to give anything a try," he said.

Hawkins said, "I cannot say enough about her . . . . She gave her all to the FBI."

Ahrens was one of about 620 female agents among the bureau's 8,900, a bureau spokesman in Washington said. He said FBI Director William H. Webster called her death "a grievous loss to the FBI."