WASHINGTON — Over the years, John R. Bolton has played many roles in Washington. He was American ambassador to the United Nations, where he famously suggested the place could lose many of its floors — and the bureaucrats who worked on them. He was the State Department’s combative counterproliferation chief during George W. Bush’s first term, and these days he regularly appears on Fox News to denounce the Obama administration as weak and feckless.

It turns out he is also the favorite neoconservative of Iranian hackers.

Mr. Bolton said he learned this week that his identity had been stolen by hackers whom a Texas cybersecurity firm identified as a group of Iranians. It is not clear if they were government agents, part of the “cybercorps” that Iran organized after American- and Israeli-developed cyberattacks on its nuclear infrastructure, or whether they were “patriotic hackers.”

But clearly they were in search of information about Washington’s elite. In the old days of the Cold War, they would have operated by hanging out at the Occidental Grill or cocktail parties at the French Embassy, hoping to pick up a bit of loose conversation. These days, they did it by creating a fake LinkedIn account for Mr. Bolton, and gradually engaging in chats with people who believed that they were exchanging thoughts with a man who some conservatives hope will run for president.

“I think the Iranians were after me to get all the secrets that the Obama administration has imparted to me about the Iranian nuclear program,” Mr. Bolton, now a scholar at the American Enterprise Institute here, said dryly on Friday.