KABUL, Afghanistan — With American and European sanctions spurring a currency crisis in Iran, officials say a growing number of Iranians are packing trucks with devalued rials and heading to the freewheeling currency market next door in American-occupied Afghanistan, to trade for dollars.

The rial has lost more than half its value against the dollar, and cross-border bank transfers and currency exchanges have become difficult, as sanctions have slashed Iran’s vital oil revenue and cut the country off from international financial markets. Iranian businesses and individuals are desperate to avoid further losses, by converting their money and moving it out for safekeeping. At the same time, the government is trying to find alternate ways to bring in hard currency.

Enter Afghanistan, where dollars function as a second national currency after years of Western spending and where financial oversight is so lax that billions of dollars in cash leave the country every year. Though Afghan and Western officials say they cannot put a precise figure on the trade with Iran, they see it as a potential challenge to the sanctions, and one that the United States, as Afghanistan’s main benefactor, helped create.

The Iranians are “in essence using our own money, and they’re getting around what we’re trying to enforce,” one American official said.