SAN FRANCISCO — Google will begin requiring those who buy ads related to federal elections in the United States through its sprawling advertising network to prove that they are citizens or lawful residents of the country.

In a blog post published on Friday, Google said it would take steps to verify if people or organizations are allowed to buy political advertising and ask them to prove that they are who they say they are. It will, for example, ask a political action committee for an Internal Revenue Service-issued employer identification number, or ask an individual for government-issued identification and a Social Security number.

In October, Google disclosed that the Internet Research Agency, a Russian company accused of meddling in the 2016 presidential election, had spent nearly $5,000 buying online advertising during the election cycle.