Recent months have seen a former Marine from Indiana, a Tea Party activist from California and a nurse from Tennessee all arrested and charged in New York City for possession of firearms they had legal permits to carry back home. All were “nabbed” when they naively sought to check the weapon with security.

These innocents fell afoul of the nation’s toughest gun laws. But few New Yorkers know how those laws came to be.

The father of New York gun control was Democratic city pol “Big Tim “Sullivan — a state senator and Tammany Hall crook, a criminal overseer of the gangs of New York.

In 1911 — in the wake of a notorious Gramercy Park blueblood murder-suicide — Sullivan sponsored the Sullivan Act, which mandated police-issued licenses for handguns and made it a felony to carry an unlicensed concealed weapon.

This was the heyday of the pre-Prohibition gangs, roving bands of violent toughs who terrorized ethnic neighborhoods and often fought pitched battles with police. In 1903, the Battle of Rivington Street pitted a Jewish gang, the Eastmans, against the Italian Five Pointers. When the cops showed up, the two underworld armies joined forces and blasted away, resulting in three deaths and scores of injuries. The public was clamoring for action against the gangs.

Problem was the gangs worked for Tammany. The Democratic machine used them as shtarkers (sluggers), enforcing discipline at the polls and intimidating the opposition. Gang leaders like Monk Eastman were even employed as informal “sheriffs,” keeping their turf under Tammany control.

The Tammany Tiger needed to rein in the gangs without completely crippling them. Enter Big Tim with the perfect solution: Ostensibly disarm the gangs — and ordinary citizens, too — while still keeping them on the streets.

In fact, he gave the game away during the debate on the bill, which flew through Albany: “I want to make it so the young thugs in my district will get three years for carrying dangerous weapons instead of getting a sentence in the electric chair a year from now.”

Sullivan knew the gangs would flout the law, but appearances were more important than results. Young toughs took to sewing the pockets of their coats shut, so that cops couldn’t plant firearms on them, and many gangsters stashed their weapons inside their girlfriends’ “bird cages” — wire-mesh fashion contraptions around which women would wind their hair.

Ordinary citizens, on the other hand, were disarmed, which solved another problem: Gangsters had been bitterly complaining to Tammany that their victims sometimes shot back at them.

So gang violence didn’t drop under the Sullivan Act — and really took off after the passage of Prohibition in 1920. Spectacular gangland rubouts — like the 1932 machine-gunning of “Mad Dog” Coll in a drugstore phone booth on 23rd Street — became the norm.

Congressional hearings in the 1950s, followed by the feds’ prolonged assault on the Mafia succeeded in tamping down traditional gangland violence, but guns are still easily available to criminals.

Today, the spate of tourist arrests has some politicians scrambling to reassess the laws. Assembly Speaker Sheldon Silver says he’ll hold committee hearings to examine enforcement of the law and recommend possible changes.

That’s a good first step. Every state but Illinois has some form of concealed-carry permission — although some, like New York, California and New Jersey, are heavily restricted. Some sort of reciprocity is needed.

Meanwhile, savor the irony of an edict written by a corrupt politician to save his bad guys from the electric chair’s now being used against law-abiding citizens from other states.

And the rest of the story? Big Tim was already suffering from tertiary syphilis when he wrote his law. He went mad soon thereafter and was sent to a sanitarium in 1912. He eventually escaped. His severed body was found on railroad tracks in The Bronx in August 1913.

The dedicated lifelong “public servant” left behind an estate valued at more than $2 million.