SAN FRANCISCO — For months, Facebook’s critics — ranging from Silicon Valley executives to Washington politicians — have been urging the company to do a better job of identifying who is buying political ads and creating pages about hot-button topics on its social media sites.

On Friday, just days before its chief executive, Mark Zuckerberg, is expected to testify before Congress, Facebook said it had started forcing people who want to buy political or “issue” ads to reveal their identities and verify where they are.

Mr. Zuckerberg announced the move in a post on Facebook. He said this verification was meant to prevent foreign interference in elections, like the ads and posts from so-called Russian trolls before and after the 2016 presidential election.

Mr. Zuckerberg added that he supported a Senate bill, the Honest Ads Act, that would bring political advertising on the internet more in line with what is required on broadcast television. One of the sponsors of the bill, which has some bipartisan support but is still in the committee stage, said that statement was a reversal from what Facebook had earlier indicated.