In the wake of deadly police shootings in Dallas and Baton Rouge, a Georgia judge told a man he picked the wrong time to resist arrest and sentenced him to six months behind bars.

According to The Augusta Chronicle, Richmond County deputies involved in the May 4 traffic stop of 49-year-old Earnest Matthews recommended probation. Because of current events, Richmond County Superior Court Judge J. Wade Padgett handed down the harsher sentence.

Earnest Matthews, who spent eight years in a North Carolina prison for a crime he did not commit, was pulled over in May for a busted brake light, the newspaper reported. A deputy ran Matthews’ name through the computer and discovered a warrant out of South Carolina. Matthews was told he was under arrest. He thought he’d paid the fine for the South Carolina misdemeanor case and resisted. Deputies used a stun gun twice and arrested Matthews on a felony charge of obstruction of law enforcement.

At the hearing Thursday, Matthews apologized to the deputies for his behavior and said his actions were unjustified, according to The Chronicle. Matthews will get credit for the 2½ months he has been in jail since his arrest, but will be on probation for three years after he is released.