He was given a new heart and a second chance at life — but a troubled suburban Atlanta teenager threw it all away.

Transplant recipient Anthony Stokes, 17, died Tuesday when he crashed a stolen car he was driving while fleeing from cops — two years after receiving national attention over the circumstances surrounding his lifesaving surgery.

Doctors at Children’s Healthcare of Atlanta Hospital originally rejected Stokes’ bid for a transplant due to his history of bad ­behavior and “noncompliance.”

Suffering from heart disease in 2013 at age 15, Stokes had been given six to nine months to live.

But officials denied him a place on a transplant list due to his history of run-ins with the law and their view that he was not a “productive citizen,” according to family spokesman Mark Bell.

Transplant recipients must ­adhere to a strict medication and follow-up regimen and have a strong family-support mechanism, doctors said.

But the hospital reversed itself after the story made headlines, and he received a new heart in a five-hour surgery.

At the time, Stokes explained that the operation would help straighten out his life.

His second chance was cut short Tuesday when he crashed while fleeing police who had tried to pull him over in Roswell, Ga.

Driving a Honda that he had allegedly carjacked from a shopping mall, the teen had kicked in an elderly woman’s front door and fired a gun at her as she watched television, authorities said.

The bullet missed — and she managed to flee and call police, an Atlanta TV station reported.

After neighbors gave officers a description of the car Stokes was driving, they spotted him a few minutes later and tried to pull him over.

He then led cops on a chase and struck a pedestrian as he tried to elude the law, authorities said.

The reckless youth then crashed into another vehicle and finally smashed into a pole.

He was rushed to a hospital, where he died, authorities said.

“We are deeply saddened by this loss,” officials at Children’s Healthcare said in a statement, adding that they could not provide any additional information about “this tragic situation.”

The 33-year-old pedestrian struck by Stokes was in good condition at a hospital.

Stokes’ family couldn’t be reached Tuesday for comment.

The average cost of a heart transplant in 2013 was between $550,000 and $650,000, according to the Orlando Sentinel.

It wasn’t clear who had paid for Stokes’ surgery.

The United Network for Organ Sharing reported that there are about 4,000 people nationwide on heart-transplant waiting lists.