A 68-year-old man who opened fire on a court security officer in Phoenix, Ariz.,has been arrested and charged with assaulting a federal officer, the FBI said Wednesday.

James Lee Carr is accused of driving a silver sedan Tuesday near the Sandra Day O'Connor federal courthouse and firing three times at the officer, striking him in his protective vest.

The officer returned fire, shooting back eight times as Carr sped away.

COMPTON 'AMBUSH' LEAVES TWO LA COUNTY SHERIFF'S DEPUTIES 'FIGHTING FOR THEIR LIVES'

Carr then called his brother, who contacted the rest of his family, and was able to take the gun away from him and call authorities. According to court documents, Carr told his son that he "snapped and shot a security guard" because he "was harassing him."

The security officer was inspecting a UPS truck for entry into the downtown courthouse at the time of the shooting. He was transported to the hospital with non-life-threatening injuries and is expected to make a full recovery.

Federal law enforcement personnel stand outside the Sandra Day O'Connor Federal Courthouse Sept. 15, in Phoenix. A drive-by shooting wounded a federal court security officer Tuesday outside the courthouse in downtown Phoenix, authorities said. The officer was taken to a hospital and is expected to recover, according to city police and the FBI, which is investigating. (AP Photo/Ross D. Franklin)

CLICK HERE TO GET THE FOX NEWS APP

Carr's son said his father has mental health problems. He remains in federal custody.

In June, a court security officer was shot and killed while guarding a federal courthouse in Oakland amid protests over police brutality. An Air Force sergeant with connections to the far-right "Boogaloo" movement was charged in the shooting.

The Associated Press contributed to this report.