This story was co-published with Philly.com . A version of this story also appeared in TIME .

Introduction

Donald Trump hasn’t been shy about voicing hostility toward foreigners.

The Republican presidential nominee has proposed banning Muslim immigrants to the United States. He’s asserted that “a lot” of refugees fleeing Middle Eastern violence are members of the terrorist organization ISIS. And in a bid to curb illegal immigration and keep out drug dealers and “rapists,” he’s called for a “big, beautiful” wall to be built on the U.S.-Mexico border.

And yet the Center for Public Integrity has determined that Trump’s presidential campaign, earlier this year, accepted an illegal contribution from a Canadian Muslim with a soft spot for Syrian refugees.

Foreigners are generally prohibited from making political contributions, and in response to questions from the Center for Public Integrity, Trump spokeswoman Hope Hicks said the campaign is now refunding $225 to Shahriyar Nasir of Toronto, who may be among Trump’s least likely contributors.

Shahriyar Nasir of Toronto, who donated $225 to Trump’s presidential campaign in April. That contribution is now being refunded. (Facebook)

Nasir is a millennial who works as a software engineer. On Twitter, he describes himself as a “proud Muslim,” and he’s been involved with an interfaith group that helps refugees from war-ravaged Syria settle in Canada.

Did Nasir have a conversion experience this year that led him to support Trump?

Far from it.

Here’s how his ill-fated Trump donation came to be: One of Nasir’s friends wanted to exercise more, so they made a bet. For each day the friend skipped a workout, he’d be required to donate to an “anti-charity,” which, in this case, was Trump.

When the moment of truth came in April, Nasir’s friend had missed enough days to owe 300 Canadian dollars. At the time, the friends calculated that amount equaled $225.

A few keystrokes later, though, Nasir was the one joining the ranks of thousands of Americans who have donated to Trump’s campaign. That’s because his friend used Nasir’s credit card to make the online donation — with the intent of paying Nasir back.

“I wanted him to feel the pain of having lost his bet,” Nasir told the Center for Public Integrity. “The donation that you discovered was made with the intent of helping my friend learn a powerful life lesson. Not with the intent of any kind of publicity or actually supporting Trump.”

The friends documented the learning experience in a video that was, until recently, posted publicly on YouTube. (It’s now private.)

During one moment of levity in the video, Nasir’s friend points to his right bicep and says: “The lack of guns here is a testament to how great your wall is going to be.”

Notably, Nasir and his friend may have never intended to financially support Trump’s presidential campaign.

Throughout the video, the young men repeatedly refer to donating to Trump’s “foundation.”

Trump does operate a charitable foundation, the Donald J. Trump Foundation, which is a separate legal entity from his campaign.

But they didn’t send the money to Trump’s foundation, which itself has been embroiled in controversy surrounding an illegal gift it made three years ago to a political group supporting Florida Attorney General Pam Bondi.

Nasir’s money instead went to Trump’s campaign, which, unlike the foundation, is prohibited from accepting money from foreign nationals unless they hold a green card, which Nasir does not.

“We didn’t pay close attention to the details of the transaction,” Nasir acknowledged to the Center for Public Integrity. “We inadvertently made the contribution to the political campaign and not the charitable foundation.”

Only U.S. citizens and immigrants with permanent resident status may lawfully contribute to federal political candidates.

To be safe, political campaigns should pay extra attention to contributions received from people living outside the United States, said Ken Gross, who heads the political law practice at the firm Skadden, Arps, Slate, Meagher & Flom in Washington, D.C.

“Typically, a campaign or PAC will take steps to affirm that the donor is a U.S. citizen or green card holder,” Gross said.

Neither Hicks, Trump’s spokeswoman, nor Don McGahn, Trump’s campaign lawyer and a former chairman of the Federal Election Commission, responded to questions about how the campaign vets contributions from foreign addresses.

(Update, Sept. 13, 2016, 9:58 a.m.: In a letter to the FEC filed Monday night, Trump campaign treasurer Timothy Jost stressed that the campaign has “safeguards in place to ensure that all contributions are made by permissible individuals only.” Among the measures reportedly being taken: requesting copies of valid U.S. passports for donors giving foreign addresses. The Trump campaign, Jost continued, “rejects contributions from contributors whose status cannot be confirmed with a passport.”)

Paul S. Ryan, deputy executive director of the Campaign Legal Center, a nonprofit campaign finance reform advocacy group, said that while this “light-hearted fun between buddies” was not “particularly troubling,” it was still a violation of the law prohibiting contributions from foreign nationals.

“You cannot undo a violation of federal law by getting a refund or seeking a refund of your contribution once you’re caught,” Ryan continued. “The question is whether it’s a significant enough violation that the FEC would care.”

FEC spokeswoman Judy Ingram declined to comment on the specifics of this case.

The agency typically sends letters to campaigns asking for additional information when it notices contributions that appear to be impermissible.

The FEC did just that in August, flagging Trump campaign contributions from three individuals with foreign addresses. But Nasir was not among them.