A man accused of carjacking a Whitney Young High School teacher at gunpoint earlier this week denies his involvement in the incident, according to his attorney.

Despite a criminal record that includes robbery and weapons charges, 20-year-old Nicholas Williams has been working hard to turn his life around and didn’t know the car he was found driving on Tuesday had been stolen, his attorney Cathryn Crawford said at his bail hearing Thursday.

Crawford asked that Williams, who is currently on probation for a weapons conviction and now faces a felony count of possession of a stolen vehicle, be released on a personal recognizance bond.

Judge John F. Lyke Jr. instead denied Williams bail, saying that releasing Williams on bond would be “totally inappropriate.”

Williams, of West Garfield Park, is accused of approaching the woman with a gun Tuesday morning as she sat in her car in a staff parking lot.

Williams allegedly told the woman, “B- - - -, get out of the car,” and demanded her purse and phone before driving off just as classes were starting, according to Cook County prosecutors and Chicago police.

The teacher was unharmed.

Later that day, Williams was arrested several blocks away in the 2100 block of West Maypole Avenue when he was found driving the vehicle, police said.

Despite accusing Williams in court of carjacking the woman, prosecutors have only charged with him possessing the stolen vehicle. A spokeswoman for the Cook County state’s attorney’s office did not immediately respond to a request for comment Thursday afternoon.

Crawford, of the Lawndale Christian Legal Center, called Williams a “hardworking” young man who has been “on a path of real progress” after multiple run-ins with the law.

Recently, he had been working for McDonald’s at Navy Pier, and was using his wages from the job to keep his family from being evicted from their home, Crawford said.

“There is no way he would knowingly put himself in a stolen vehicle,” Crawford told Judge Lyke, noting that Williams had too much to lose by doing so and that it would “disappoint” the many people who have been helping him. She said a friend had let him borrow the car.

Cook County court records show that Williams has been arrested twice in the past two years on gun charges. He also has a juvenile conviction for armed robbery.

In October 2018, Williams and another man were driving in the 3600 block of West Douglas Boulevard when officers pulled them over for driving erratically, police records show.

Once they were out of the car, one of the officers noticed a bulge in Williams’ waistband. When an officer tried to search him, Williams tried to block the officer’s hand before trying to run away.

As he tried to escape, he continued grabbing at his waistband, “further causing [the officers] to believe he was concealing a firearm or other contraband,” according to police records. He was arrested almost immediately and told police he found the gun.

Williams was charged with eight counts of aggravated unlawful use of a weapon, court records show. He pleaded guilty to one of those counts on April 2 this year and was sentenced to a year of probation and ordered to perform 30 hours of community service.

Crawford agreed that Williams “got off track” following the death of his brother last year, who she said was killed “under bizarre circumstances” while riding in a car with a person who shot him in the head.

After his brother’s death, Williams began carrying a gun for security, she said.

Following the hearing, Crawford said she was “confident there is sufficient proof [Williams] wasn’t anywhere near the carjacking,” when it occurred, but declined to elaborate.

Two women who attended the hearing on Williams’ behalf also declined to comment, saying that coverage of Williams by the media has so far been inaccurate.

Read more on crime, and track the city’s homicides.