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.
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.
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.