The judge wasn’t convinced that the man standing before him — someone who’d stolen the identity of the former director of the National Security Agency — had cleaned up his act.

It didn’t help that while awaiting trial, Carnell King had allegedly been caught applying for a credit card in someone else’s name.

But on Tuesday, U.S. District Judge Robert Gettleman was at least partly swayed by King’s soft-spoken apology and desire to steer his own kids from a life of crime.

Gettleman gave King a big break, handing him a prison term 16 months below the low end of the sentencing range. King’s sentence: 4 1/2 years behind bars.

“This isn’t an opportunistic crime you committed. This was a very calculated crime,” Gettleman said.

King told Gettleman: “I’m remorseful for what I’ve done. … I’ve made mistakes. I know I can do better with the help of my father.”

The feds arrested King in June 2014 after searching his home in the 5300 block of West Jackson. They said they found 56 credit cards in the names of “various individuals.” They also found checks and checking account paperwork in the name of Gen. Keith B. Alexander, the former NSA director. The federal complaint against King alleges that starting in February 2014, Alexander began receiving mail, emails and phone calls that someone had made several attempts to open credit cards using his personal information. When Alexander tried to file his tax returns that month, the tax software he used told him someone using his name had already filed a tax return — and was issued a $9,000 tax refund.

Alexander wasn’t in court Tuesday, although he was one of several victims who sent letters to Gettleman — correspondence judges typically use to help them determine a sentence.

King’s attorney argued for a low sentence, pointing out that while his client may have retrieved large amounts of stolen information from online searches, he’d actually profited little — receiving slightly less than $11,000 in total.

“This is Mr. King playing on his computer — full of sound and fury — but accomplishing very little,” attorney John Beal said.

Perhaps so, said Gettleman, but he also noted that victims had written to him with “very poignant” stories of having their credit ratings “destroyed.”

King is due to report to prison on Nov. 1.