A man who fired two handguns at two Fairfax County police officers Saturday afternoon, wounding one of them, has been charged with two counts of attempted capital murder, police said yesterday.

Several officers returned fire, striking Joseph D. Oliver, 56, once in the upper part of his body, according to a police affidavit filed yesterday in Fairfax Circuit Court. The injured officer, who was shot in the leg, was scheduled to be released from Inova Fairfax Hospital yesterday.

It was not clear yesterday who fired the first shot outside Oliver's apartment building in the Kingstowne area of Fairfax. Lt. Richard Perez, a police spokesman, said he would not comment on the specifics of the shooting, and he declined to identify the officers involved, saying that they were crime victims, whose names usually are not released.

Oliver, of the 6000 block of Palladium Court, was reported missing by his father Oct. 11 and had told family members that he wanted to commit suicide, according to a search warrant affidavit by homicide detective Steven G. Milefsky.

Officers responding to a call encountered Oliver about 2 p.m. Saturday and were informed of his background. They negotiated with him for two hours, police said.

"We tried extensively to end this confrontation peacefully," Perez said. "We tried to talk him into leaving the weapons behind while we provided security to the surrounding areas."

According to Milefsky's affidavit, about 4 p.m., Oliver fired both weapons at the officers, who were crouched behind parked cars and plastic riot shields. One shot struck the 24-year police veteran in the upper leg, and another nearly struck an officer's head, police said.

Oliver was still in the hospital yesterday.

The last time a Fairfax officer was shot by a suspect was in June 1991, officials said yesterday. In that incident, Officer Darryl F. McEachern was shot in his lung and back by a 16-year-old boy who was under the influence of LSD and had grabbed another officer's gun and fired it repeatedly during a struggle with five officers. No Fairfax officer has ever been shot to death in the line of duty.

On Oct. 11, according to Milefsky's affidavit, Oliver left a note for his father saying he "had cancer and intended to end his life." Oliver e-mailed his sister the next week and told her the same thing. The sister responded that she and her father would be at Oliver's apartment Saturday, Milefsky wrote.

When his sister and father arrived, Oliver came out and told them he had two guns and wasn't giving them to anyone, Milefsky wrote. His relatives called police, launching the standoff.