Open this photo in gallery:

Semi-automatic rifles fill a wall at a gun shop in Lynnwood, Wash. in October, 2018.Elaine Thompson/The Associated Press

The Trump administration sued California and Virginia on Wednesday over new laws in both states that restrict the sale of semi-automatic firearms.

The two separate lawsuits filed by the Justice Department in federal court say the laws violate the Second Amendment.

“The Constitution is not a suggestion, and the Second Amendment is not a second-class right,” Acting Attorney General Todd Blanche said in a news release announcing the lawsuit against Virginia.

Virginia’s Democratic governor, Abigail Spanberger, signed legislation earlier this year banning the sale and manufacture of certain semi-automatic firearms. The law, which took effect Wednesday, is facing at least four other lawsuits challenging its constitutionality.

The California law prohibits gun shops from selling certain handguns that can easily be made fully automatic.

Attorneys general in both states vowed to defend their gun laws.

U.S. Supreme Court will consider whether assault weapon bans violate the Second Amendment

In a statement, the office of Virginia Attorney General Jay Jones said the ban on selling certain semi-automatic firearms was a “common sense” measure that “keeps Virginians safe, protects law enforcement, and safeguards communities across the Commonwealth.”

Spanberger’s office also defended the law, saying Wednesday in a statement that the governor believes “firearms designed to inflict maximum casualties do not belong in our communities, near our kids and schools, or on Virginia’s streets.”

The California attorney general’s office said in a statement the state had “effective and constitutional gun safety laws” that “helped drive firearm death rates to record lows.”

The California law largely bans the sale of Glock and Glock-style pistols, among the most popular type of handgun in the U.S., according to the DOJ suit.

The lawsuit is also challenging additional restrictions on handguns sold in California.

States controlled by Democrats and those led by Republicans have diverged in recent years over gun legislation, with some Republican states passing laws to relax firearm restrictions.

The U.S. Supreme Court said Tuesday it will take up another major Second Amendment case. The justices will consider whether bans on semi-automatic rifles violate the Constitution. Arguments are expected in the fall.

The court, which has a conservative majority, has expanded gun rights, including in two cases this term.

Follow related authors and topics

Authors and topics you follow will be added to your personal news feed in Following.

Interact with The Globe