Maryland is poised to be the first state in the country to regulate political ads on Facebook and other social media sites.

A bill approved by the General Assembly late Thursday would require social media platforms to track all political ads, keep copies of them and record which users are being targeted — data that state elections officials could use to track bad actors or detect foreign interference.

Facebook officials said they hoped Maryland’s legislation could be a national model for social media to disclose who is paying for political advertising.

The legislation would also require social media platforms and newspapers to quickly post public information about who bought the advertisements, whom they benefit and how much was spent — similar to existing transparency requirements for television stations.

Gov. Larry Hogan — whose Facebook page has 210,000 followers — has not said whether he intends to sign the measure.

Facebook was against regulation, but then took a role in passing the legislation it now supports. Less than 24 hours after the bill passed in Annapolis, the Silicon Valley company announced a new national policy with similar provisions that requires advertisers to confirm their identities.

Will Castleberry, Facebook’s vice president for state policy, said the company helped draft the Maryland legislation and “looks forward to implementing” it.

“We believe this bill will be a national model for the other 49 states to follow,” he said in a statement.

Facebook has been at the center of a political furor for months, most recently over revelations that data from millions of users were leaked to digital consultants who used it to help Donald Trump’s presidential campaign. In February, Special Counsel Robert S. Mueller brought charges against Russian individuals and organizations who he says used Facebook and other social media platforms to meddle in the election. Facebook executives have been called before Congress to explain.

The Maryland legislation, approved by the House and Senate by wide margins, would apply to political ads placed on Google platforms, Twitter and on any other site with at least 100,000 unique monthly visitors.

"This will transform how online ads are purchased," said Sen. Craig Zucker, a Montgomery County Democrat who sponsored the bill and led negotiations. "We’re going to bring transparency to websites and make sure we prevent foreign influence in our elections, when it comes to paid media."

It resembles legislation in Congress aimed at monitoring political advertising on social media. New York, California and Connecticut are weighing their own measures. “We need to catch up with the times,” said Del. Alonzo T. Washington, the Prince George’s County Democrat who sponsored the bill in the House. “We’re holding online platforms accountable. We’re trying to protect our elections.”

Maryland’s legislation would apply to both campaign and issue ads, as well as payments to boost Facebook posts or promote tweets to reach a wider audience. It would apply to local and state contests, not congressional or presidential races.

From 2012 to 2016, spending on political digital ads increased 789 percent, the trade magazine AdAgecalculated.

Hogan, a Republican, used Facebook to build the “Change Maryland” operation that became the foundation of his campaign in 2014. He remains an avid Facebook user.

“The governor has always advocated for greater transparency in the political process, and he is supportive of these types of efforts,” spokeswoman Amelia Chasse said. “We’ll closely review the bill.”

The legislation would give the Maryland Board of Elections the authority to seek subpoenas to investigate how campaigns and advocacy groups use social media to target voters.

“It brings a level of enforcement that we’ve never had before with online ads,” said Jared DeMarinis, the election board’s director of campaign finance.

Maryland started trying to regulate political ads on social media in 2010. Bradley Shear, a lawyer who focuses on a social media and privacy, advised state election officials on how to create such policies back then, but says the effort was thwarted by heavy lobbying from social media companies.

“We really should have the knowledge and be able to to see how Facebook is using your data to literally allow for the weaponization of your personal information against you,” he said.

An association of media outlets including The Baltimore Sun has objected to a part of the Maryland bill that would require all sites to publish a table of political ad purchases. They argue that compelling media organizations to publish anything violates the First Amendment.

“We believe in free and fair elections, and we support transparency,” said Rebecca Snyder, executive director of the Maryland-Delaware-D.C. Press Association. “We think this bill is flawed because we don’t believe that we should be compelled to publish this report.”

Snyder said it’s possible that forcing newspapers to publish anything might lead to a lawsuit challenging the measure.

“It is within the realm of possibility,” she said. “I wouldn’t want that to happen. That doesn’t get us what we’re all after, which is an election free of the influence of Russian bots.”

ecox@baltsun.com

twitter.com/ErinatTheSun