A man was in custody early Friday morning after a carjacking attempt in North Carolina.

Deputies said a gunman tried to carjack a woman in her driveway around 8:30 a.m., but she managed to get away and jumped onto a nearby school bus to get help.

Investigators said the assailant came up from behind the woman with a gun and tried to get into her car.

She locked the doors and was able to get out of her driveway, deputies said.

The woman drove down the street to her daughter’s school bus stop, jumped onto the bus and asked for help, authorities said.

The would-be robber fled on foot, deputies said. A SWAT team that was training nearby joined police, who were able to catch the man after about an hour and take him into custody, officials said.

The man didn't have a gun at the time of his arrest. Deputies searched for the weapon and found it nearby.

Investigators have swabbed the woman’s car for DNA evidence.