He defended the Confederate flag and insulted immigrants. Now he’s a judge.