HUNTSVILLE, Alabama -- A man was able to get away safely after two men allegedly tried to rob him Wednesday night, police said.

The man was driving in the 200 block of Swanson Drive around 10 p.m. when two men flagged him down and asked for a ride, police said. As one of the men was getting into the car, he pulled out a pistol and demanded money from the driver, according to the police report.

The driver sped away causing the gunman to jump out of the car, police said. Both would-be robbers ran from the street, and the driver wasn't injured, authorities said.