A purported street-gang member charged in the shooting of an ATF agent in Chicago had opened fire as authorities conducted a middle-of-the-night "covert" operation to fit a tracking device on a vehicle, according to charging documents made public Tuesday.

Ernesto "Ernie" Godinez, a 27-year-old who is listed by police as a gang member, is charged with forcible assault of a Bureau of Alcohol, Tobacco, Firearms and Explosives agent in the unsealed complaint.

The agent, whose name hasn't been released, was shot once in the face Friday and is expected to make a full recovery. The complaint did not provide additional details about the ATF operation, including whether Godinez may have been one of its targets. It also didn't suggest a possible motive for the shooting or whether authorities believe Godinez knew he was firing at an ATF agent.

Godinez made his first appearance in U.S. District Court on Tuesday, with dozens of federal agents crowding spectator benches. Asked by U.S. Magistrate Judge Maria Valdez if he understood the charge, Godinez nodded. Prodded by his lawyer to answer out loud, he added softly, "Yeah, yeah." He stood in orange jail clothes, with a tattoo on his forearm and his long hair tied at the back. He was not required to enter a plea.

More than 50 ATF and other federal agents packed courtroom benches just behind the suspect in a show of support for the injured agent. Other agents sat in a nearby overflow room to listen to audio of the proceedings.

If convicted, Godinez faces up to 20 years in prison. More charges could be added later.

Godinez was arrested Monday night. A bond hearing is set for May 17 and a prosecutor told the magistrate judge that the government would oppose his release on the grounds he was dangerous and a flight risk. Godinez has a criminal history, including convictions for aggravated discharge of a firearm and aggravated unlawful use of a weapon for which he spent less than a year in prison, according to the Illinois Department of Corrections.

The agent was shot around 3:20 a.m. Friday in the Back of the Yards neighborhood on the South Side. Godinez, dressed in shorts and a T-shirt, walked from his nearby residence about a block and shot seven times down a street toward several agents, striking the one agent in the face, according to the complaint. He then ran back to the residence.

Surveillance footage from several cameras and sensors that record the location of gunshots helped lead investigators to Godinez, the court filing says. The streets were otherwise empty, making it easier to track Godinez via the surveillance photos, it adds.

Minutes after entering the house, Godinez walked out again, wiping his face and holding a cellphone; he walked down a street and got into a dark vehicle that seemed to arrive to pick him up, the affidavit says.

Godinez's older brother, Rodrigo "Gordo" Godinez, appeared in the same courtroom on distribution of cocaine charges later Tuesday. Prosecutors did not say whether the siblings' cases were related. The older brother's arrest stems from a recent drug trafficking investigation led by the ATF in the same neighborhood, during which he was recorded selling 258 grams (9.1 ounces) of cocaine for more than $8,000 cash to an undercover agent on May 1, a complaint says. His bond hearing is set for Thursday.

The ATF has raised its profile in Chicago amid a persistently high homicide rate. Chicago police and the ATF last June announced the formation of the Chicago Crime Gun Strike Force aimed at stemming the flow of illegal guns. The ATF also sent an additional 20 agents to Chicago and loaned the city a van outfitted with ballistic testing equipment to help police more quickly solve gun crimes.

___

Follow Michael Tarm on Twitter at https://twitter.com/mtarm