CHICAGO (CN) – An off-duty Illinois police officer was justified in shooting and killing a teen during the robbery of a pizzeria because he had no way of knowing the teen was unarmed, the Seventh Circuit ruled.

In October 2011, three young men and 16-year-old Michael DeAngelo Sago, Jr. walked into Marie’s Pizza in Rockford, Ill., with the intent of robbing the store, according to court records.

Unfortunately for them, the only customer inside the pizzeria was off-duty police officer Frank Pobjecky waiting for his order.

When the first robber pointed a gun at the restaurant manager and demanded money, the manager yelled, “Get the hell out of here, you’re not getting any of my f’ing money,” court records show, and immediately tried to grab the robber’s weapon.

Pobjecky knew the manager carried his own concealed weapon, and endeavored to grab the manager’s gun before the robber could get it.

The off-duty officer then shot each of the three men who entered the store, wounding them, and shot Sago three times in the back as the teen tried to run away, killing him.

Pobjecky never identified himself as a police officer or ordered anyone to stop before opening fire. The restaurant manager took the robber’s gun, but did not fire any shots.

Sago’s family sued Pobjecky and Winnebago County, claiming the officer’s shooting of the unarmed teen was an excessive use of force.

But a federal judge ruled against the family, and the Seventh Circuit affirmed Tuesday.

“Pobjecky reasonably assumed the three other assailants, including Michael, might be armed. As the district court correctly observed, we may not consider the fact that it turned out Michael was unarmed because Pobjecky did not know that, and had no reasonable way to know that, at the time,” U.S. Circuit Judge Daniel Manion wrote for a three-judge panel.

The 23-page opinion notes that the entire incident happened in about 40 seconds, and that judges must be careful not to second guess the actions of police officers in the heat of the moment.

“No reasonable jury could find Pobjecky’s belief that Michael might be armed was unreasonable,” Manion continued. “Michael participated in an armed robbery while wearing a sweatshirt allowing easy concealment of a gun.”