Bail was denied Friday for a seven-time convicted felon charged with fatally shooting a man on the West Side and then wounding an undercover police officer who authorities said witnessed the murder.

Judge John F. Lyke praised the wounded police sergeant, calling him a “superhero” after Cook County prosecutors testified that he pursued 35-year-old Walter Johnson and apprehended him instead of going directly to a hospital after being shot in the incident earlier this week.

The sergeant, who has not been publicly identified, “decides his safety is not as important as the safety of the citizens of Cook County,” Lyke said. “I’d say that makes him a superhero.”

Lyke ordered Johnson held without bail at the hearing, where Johnson faced counts of first-degree murder, first-degree attempted murder of a police officer, aggravated battery with a firearm and unlawful use of a weapon by a felon.

The sergeant, who was in plainclothes and in an unmarked police SUV, was on patrol about 2:30 p.m. Wednesday in the 4000 block of West Madison Street when he heard a gunshot and saw Johnson fatally shoot 26-year-old Devel Hill on the sidewalk, prosecutors said.

The sergeant watched Johnson run to a white pickup truck that was parked in an alley and then followed him in his SUV, according to prosecutors.

However, when Johnson noticed he was being followed, he stopped the pickup in the 4100 block of West Wilcox, got out and walked up to the sergeant’s SUV and began firing, prosecutors said. The officer suffered a graze wound to his arm near his shoulder and was also struck in the wrist, prosecutors said.

Johnson sped off again in the pickup and the wounded officer was taken into the vehicle of officers who were responding to the shootings, prosecutors said. As they were taking the sergeant to the hospital, the officer spotted the white pickup on Interstate 290 and they pursued it until the pickup crashed into several cars and finally a tree in the 2000 block of West Congress Parkway, authorities said.

Johnson allegedly ran from the vehicle, holding a red-hooded sweatshirt he was seen wearing at the time of the initial shooting and threw it to the ground as officers pursued him, causing a 9-mm handgun to fall from the sweatshirt’s pocket to the ground.

That gun, which had an extended magazine and a laser sight, was recovered and matched with shell casings found at the scenes of both shootings.

Johnson and a woman who was with him in the pickup were taken into custody and the wounded officer was then brought to Stroger Hospital, where his condition was stabilized, police said.

Johnson has been convicted of seven felonies since 2007, including for drug and driving violations, according to court records. In 2008, he was convicted of battering two officers during an arrest, in which he tripped one office with a “leg sweep” and punched the other officer, prosecutors said.

Michael Bianucci, a private attorney for Johnson, said he was a lifelong resident of Cook County, has four children and works in construction.

Judge Lyke, citing his history of felony convictions, as well as witness statements and video from multiple surveillance cameras that captured some of the events, ordered Johnson held without bail.

His next hearing was set for Feb. 7

Read more on crime, and track the city’s homicides.