Reflecting on his trip to Turkey apparently cost Amir Shafi his Airbnb account.

Mr. Shafi, an Iranian national living in Switzerland, booked a trip to Istanbul via Airbnb to see family, he said in an interview with Risk & Compliance Journal. He had a great time, and wanted to thank the host and the accomodation service for helping him find a place to stay.

That's when the trouble started.

While Mr. Shafi was providing feedback on Airbnb's website, an unrelated verification prompt popped up, asking him to provide a form of identification, he said. He scanned and uploaded his Iranian passport, because that was the first thing he grabbed, and logged out a little while later after completing the comment.

Several hours later, Mr. Shafi said he received an email, seen by Risk & Compliance Journal, from Airbnb saying it was closing his account due to "U.S. federal regulations that restrict the use of our site by residents of certain countries."

Airbnb spokesman Jakob Kerr confirmed the authenticity of the email.

Mr. Shafi's story points to the complexity and reach of U.S. sanctions on Iran, as well as the difficulty companies face while trying to comply with them. While apologizing in the email, Airbnb disabled his account even though such services appear to be exempted under U.S. Treasury Department regulations.

"Each time I show my passport, or use it, I get strange looks," said Mr. Shafi. "I'm used to it by now."

He replied to the email, asking for ways to undo the action, but said he received no immediate response. Ten days later, Mr. Shafi took a screengrab of the email, edited out the signature and posted it on Facebook.

Ehsan Norouzi, a friend of Mr. Shafi's who is an Iranian journalist based in Berlin, tweeted the screengrab on Monday.

Mr. Kerr said in an email the U.S. Treasury Department's Office of Foreign Assets Control sets certain restrictions on U.S. companies that prevent them from transacting with customers located in Iran, and other restricted countries.

"We take our OFAC compliance duties seriously," he said.

The San Francisco-based company is backed by venture firms including Andreessen Horowitz, DST Global, General Catalyst Partners, Greylock Partners and Sequoia Capital.

Mr. Kerr said Airbnb launched a product called Verified ID in April that allows users to get a "verified" badge on their profile if they match their online identity to offline documentation, such as a passport or a driver's license. The company requires 25% of randomly selected guests to complete the verification process before booking a reservation, as well as some users making last-minute reservations, he said.

Mr. Shafi apparently became part of the Verified ID process after his trip, setting off the chain of events that led to him losing his account.

A company like Airbnb doesn't have to bar Iranians, or Iranian nationals, from using its service so long as they aren't on a blacklist, according to a Treasury spokesman citing the Treasury regulation governing travel transactions.

"The prohibitions...do not apply to transactions ordinarily incident to travel to or from any country, including importation or exportation of accompanied baggage for personal use, maintenance within any country including payment of living expenses and acquisition of goods or services for personal use, and arrangement or facilitation of such travel including nonscheduled air, sea or land voyages," the rule says.

Mr. Kerr said the company is aware of travel exemptions to U.S. sanctions but "we don't believe they cover the full scope of Airbnb's services."

But is the company being too cautious?

Airbnb is preventing itself from conducting legitimate business and burning would-be customers by overcompensating, said Jillian York, director for International Freedom of Expression at the Electronic Frontier Foundation.

"Airbnb isn't being entirely unreasonable here but they could find another way to ask the question" about where an Iranian national user resides, she said. "This over-broad approach is not the way to go."

Ms. York was among those who weighed in on Twitter about Mr. Shafi's case Monday afternoon.

By Tuesday, Mr. Shafi said he got a call from Airbnb; the company said it was looking into his case. The person on the phone, whose name Mr. Shafi didn't recall, said the company would send an email requesting alternative identification, such as his Swiss ID. Mr. Shafi cited the discussion on Twitter, which began with his friend's tweet, as the reason for the call. Mr. Kerr confirmed the call.

-Christopher Zinsli contributed reporting to this article.

Write to Samuel Rubenfeld at Samuel.Rubenfeld@wsj.com. Follow him on Twitter at @srubenfeld.