Beretta USA says Maryland's tough new gun laws are the reason it's moving its factory to gun-friendly Tennessee.

The American subsidiary of the 500-year-old Italian company has had a factory in Accokeek, Maryland since the 1970s. The company has manufactured the M9, the U.S. Army's standard-issue sidearm, since 1987 at that factory, which is about 20 miles south of Washington, D.C.

Beretta is relocating the factory to Gallatin, Tenn., in early 2016, because it's worried that Maryland gun laws could force it out of the state.

Maryland is one of several states that have passed new gun laws to restrict military-style semiautomatic rifles and high capacity magazines since the mass shooting in Newtown, Connecticut, three years ago. These weapons have been used in subsequent mass shootings, including the recent one in San Bernardino.

The state's Firearm Safety Act of 2013, championed by former Maryland governor and Democratic presidential candidate Martin O'Malley, targets assault weapons, banning 45 guns and limiting magazine capacity to 10 rounds.

The Maryland law means that Beretta's M9 semiautomatic pistol, which holds 15 rounds, is now illegal in the state, said Beretta USA's lead lawyer, Jeff Reh. He said the ban also applies to Beretta's pistol grip shotguns, and also to the semiautomatic rifles like the ARX 100.

Reh said that the company lobbied successfully to change the law so that Beretta could continue to make, import and warehouse these guns in Maryland, even though private citizens can't own them.

Related: Remington shifts jobs from N.Y. to Alabama

Still, Reh said, the company realized that "with the stroke of a pen our ability to manufacture products for the armed forces, or police, or even civilians, could be blocked."

But the city of Gallatin, Tennessee, welcomed Beratta's $45 million gun factory with open arms and $4 million in incentives. That includes 100 acres of land worth $1.75 million and a 10-year tax abatement worth about $2.2 million, according to James Fenton, Gallatin's economic development director.

"It was the best financial package that we were offered," said Reh.

Gallatin is a city of more than 30,000 people some 20 miles out of Nashville, which puts it close to an international airport, a necessity for the gunmaker.

"We will see an immediate increase in real and personal property taxes," said Fenton. "We have seen a jump in local sales tax during the first phase of construction. Additionally, there continues to be robust interest in the area because of the [Beretta] announcement."

Fenton expects the factory to eventually employ 300 people, most of them hired locally. Beretta's sales, marketing, legal and customer service staff will stay in Maryland.

Beretta's move south started when the company's patriarch, Ugo Gussalli Beretta, asked Reh to identify "the most consistently pro-Second Amendment states in the country."

"He told me, 'If we're going to build a factory somewhere, I want to put it in a state where I don't have to worry about it, or my sons don't have to worry about it, or even my grandkids,'" said Reh. "So he's taking a 100-year view of the company."

This will be the third factory that Beretta has built since the company started in the early 1500s.

Reh said that he personally visited 80 potential factory locations in Georgia, Texas, the Carolinas, Kentucky and also Virginia, which he liked because of its proximity to Maryland. But he abandoned Virginia because Governor Terry McAuliffe, a Democrat, ran for office on a gun control platform.

Gallatin's James Fenton said that gun control laws in Virginia and Maryland are a boon for Tennessee.

"I would like to mention that the [former] governor of Maryland is my best friend for passing that legislation," he said, "even though we've never met."