A suspected gang member charged in the shooting last week of a federal law enforcement agent in the Back of the Yards neighborhood was ordered held in custody Tuesday.

Ernesto Godinez, who turns 28 on Wednesday, made his initial appearance in federal court in Chicago, facing charges that he shot an ATF agent in the face last week in Back of the Yards.

Four hours later, his older brother, Rodrigo, appeared in the same courtroom to face charges of distributing cocaine, charges linked to alleged sales he made to an undercover ATF agent — with his last deal coming just three days before his brother allegedly shot an ATF agent.

The agent for the federal Bureau of Alcohol, Tobacco, Firearms and Explosives was shot in the face early Friday as officers were attempting to replace a tracking device on a vehicle near Ernesto Godinez’s home in the 4400 block of South Hermitage, near Godinez’s home, according to a federal criminal complaint unsealed Tuesday.

Records show that Godinez had previously been convicted of shooting someone near 46th and Ashland in June 2011. He was also charged with unlawful use of a weapon in connection with an incident near 48th and Justine.

He was sentenced to two years in prison, but was given credit for 1,105 days locked up in the Cook County Jail.

Since his release, he’s been charged three times with contacting gang members while on parole. The charges were dropped twice. In the third case, he pleaded guilty and spent two days in jail.

RELATED: Massive manhunt on for gunman who shot ATF agent in face; $61K reward offered

The Cook County State’s Attorney’s office didn’t respond to requests for comment.

Speaking at the CPD’s 9th District station, Chicago Police Supt. Eddie Johnson questioned the processes of the state’s attorney’s office in cases such as Godinez’s.

“When we have individuals that consistently commit these crimes and get out of jail then we have to look at what we’re doing to hold them accountable,” Johnson said. “And if we’re not doing it, then we need to change that process and do that.”

Police have said the agent was part of the Chicago Gun Crime Strike Force created last year to combat the city’s gun violence. The task force was acting on information that a gang in the neighborhood recently obtained a cache of weapons to “get ready for the summer,” a source said.

In court records unsealed Tuesday, it appears at least one of the Godinez brothers had been in the sights of law enforcement for several months.

The complaint naming Rodrigo Godinez — whom the CPD had identified as the leader of the Almighty Saints — quotes text messages and calls he had with an undercover agent to set up drug sales, the first taking place in April.

The younger Godinez turned himself in Monday night, his attorney said. Rodrigo Godinez was arrested late Monday, prosecutors said.

Ernesto Godinez, charged with forcible assault of a law enforcement officer, will remain in federal custody pending a hearing May 17. Rodrigo was charged with three counts of distribution on cocaine, with prosecutors alleging he sold more than half a kilogram of cocaine to an undercover agent in three deals between March 20 and May 1. His detention hearing is set for Thursday. Prosecutors said in both cases, they will seek to have the Godinez brothers held without bail.

On Tuesday, Ernesto Godinez appeared in court in an orange prison jump suit, wearing glasses, with his long black hair pulled back into a bushy ponytail. ATF agents and staff packed the gallery, so many that some waited in the hallway during the five-minute hearing.

ATF agents had been in the neighborhood to replace a tracking device on a vehicle in the 4400 block of South Hermitage, the complaint states. An advance team had driven down Wood Street to scan for pedestrians ahead of the agents tasked with placing the device. After giving the agents the all-clear, the agent who was attacked was walking south near the intersection of 44th and Hermitage when he was shot, according to the complaint.

The wounded agent underwent surgery Monday, according to Celinez Nunez, special agent in charge of the ATF’s Chicago Field Division. He is expected to be released from the hospital later this week.

Two cameras captured Ernesto Godinez walking out of a house in the 4300 block of South Wood around 3 a.m. Friday, then walk across an alley to the 4300 block of South Hermitage, according to a criminal complaint.

Shortly after gunshots rang out at about 3:18 a.m., he’s seen running back across the alley to his house.

Police recovered five shell casings in the alley, and Chicago Police ShotSpotter devices in the seven recorded seven shots, according to the complaint. A bullet was found lodged in a tree near where the agent was shot, indicating that it was fired from the direction of the alley.

Minutes after the shooting, a CPD camera filmed Godinez walking out of the house, wiping his face and holding what looks like a cellphone. He walks down Wood Street, out of view, and then reappears walking back down Wood, then getting into a “dark colored vehicle” on the street.