They messed with the wrong lawmaker.

Two Pennsylvania state representatives escaped unharmed Tuesday night after they were involved in a shootout with a gunman who attempted to rob them near the state Capitol in Harrisburg.

State Rep. Marty Flynn, a former prison guard who's licensed to carry a handgun, fired the shots after he and Rep. Ryan Bizzarro were accosted by the would-be robber. Flynn told the Associated Press he thinks he might have been killed if he had not been carrying a concealed pistol.

"We are used to fighting for the people in our districts every day," Flynn said in a statement to the Philadelphia Inquirer. "We certainly are going to stand up for ourselves and not become victims."

According to the Inquirer, the lawmakers were leaving a dinner with colleagues when a teen suspect approached them, demanded their wallets and pointed a gun at them. Another suspect reportedly shouted instructions at the gunman from across the street.

Flynn drew his handgun and exchanged shots with the gunman. The lawmakers and the suspects both fled and no one was injured.

"Bizzarro and Flynn expressed relief that nobody was struck by gunfire, and they thanked the Harrisburg police for the remarkably quick response," the House Democratic Caucus said in a statement to the Inquirer.

The two suspects were caught close to the scene of the robbery, and two more teens were later arrested as accomplices. The Inquirer reported the suspects, 17-year-old Jamani Ellison, 15-year-old Jyair Leonard, 17-year-old Derek Anderson and 15-year-old Zha-quan McGhee, were all charged as adults. The group was charged with multiple crimes, including attempted homicide, conspiracy, robbery, and aggravated assault.

Police also alleged the group committed another robbery Monday night.

The Associated Press contributed to this report.