Matthew Trevithick grew up in Boston and traveled overseas in 2008 after earning a degree in International Relations. He visited Lebanon, Syria, Jordan and Israel, lived in northern Iraq, and spent four years in Afghanistan, working at the American University of Afghanistan in Kabul. In 2010, he visited Iran as a tourist. “I don’t usually drink the Kool-Aid,” he says, “but I was just absorbing this aura: This is a country we need to know more about.” The day after he left Iran, he began applying to study Farsi in Tehran, the capital. Five years later, in 2015, and one week after Iran signed a landmark nuclear deal, a new visa to return finally came through. This is his account, as told to TIME’s Andrew Katz and Karl Vick.

I thought I had totally nailed it. When I arrived on Sept. 16, I heard Oh my god. You’re from America. This is great. I was staying in a dorm in a very ritzy suburb, with a remarkable view of the mountains. But the tenor changed as Supreme Leader Ali Khamenei issued stern warnings against American “infiltration” through the nuclear deal. The domestic political situation completely shifted underneath my feet without my realizing just how quickly it was moving.

The overt surveillance that foreign students knew well grew more obvious and heavy-handed. At the café I would sit at next to the university, I started seeing a guy parked here all the time; he was just watching me, not even trying to be subtle. On Dec. 6, I Skyped with my mother to say I’d had enough. I would be home for Christmas. The next morning I stepped out to take a taxi to airline office. Three guys jumped out: Are you Matthew? Fifteen minutes later, I’m at Tehran’s Evin Prison. They take my cellphone and my computer. I’m given a big, gray cloth blindfold.

Right, left. Right, left. Very disorienting. I can’t quite place where I am. Upstairs. I’m given prison-blue smocks and white flip flops; they take the rest of my possessions, then take mug shots. They leave me with a little bit of money. The stairs creaked as we went to the second floor. My room was six feet by seven feet. There was a window you could see out, with three layers of steel grates. You sleep on the floor, under a thick, gray wool blanket, with your towel as a pillow. The light stayed on so you end up sleeping with your blindfold.

Day 1. In the interrogation room, I sit facing the wall. The first interrogator is the good cop, soft-spoken. So, Matthew. Why are you here? And what have you done? He says in English, Matthew. His prayer beads clicking in his hand. Do you know who Jason Rezaian is? The whole world knew about that Washington Post reporter. Well, he’s never leaving and neither are you.

The floor in my cell was cement with a very thin linoleum, sea-foam green. The walls were off-white, almost yellow. The door was steel with no inside handle. In solitary, guards would walk by every 10 to 15 minutes to make sure you’re alive, peeping through a window the size of a face. You’re blindfolded whenever you leave the room, pushed and pulled by the escorts.

You could tell who was around by the cologne. They drench themselves in it, so you can smell them coming. The more important the person, the sharper the scent.

You push a button if you want to go the bathroom—there was one at the end of each hall, 12 paces away. Inmates have scratched messages into the walls. You can get through this. Don’t ever give in. Don’t ever give up. Nobody stays here forever. I wrote my name in one of the cells: Matt.

Day 3. They made me lie to my mother. We already had three days with no contact, and we were checking in daily with each other by text. I’m going to the mountains? The cellphone signal is very weak and I’ll be out of touch a bit. She knows. Matt, a lot of people are thinking about you.

Day 10. Back in my regular clothes, I was taken to a nearby five-star hotel, walked through a lobby full of foreigners and taken to the 13th floor. They told me the minister of intelligence was coming to review my case, which turned out to be a lie—I Googled “minister of intelligence” afterward. I’ve read your file, don’t lie. As I’m about to open my mouth, this ultra-high-end camera appears. They want me to say I am working with CIA to overthrow the Iranian government, that I can access arms caches and millions in bank accounts. I don’t say it, because it’s not true. Back to Evin.

Day 12. The bad cop shows up. He wants me to write constantly. Write everything you know about this name. The same names, day after day. From emails. From phone calls. Who is this person? Mainly journalists. Matthew, I don’t have time for any more of your lies. I don’t have time for any more of your games. I don’t have any more time for any of this nonsense. I don’t have time.

Day 20. They shaved my head. It kind of militarized me. In a weird way, it’s very dehumanizing. The guy who’s shaving my head, he’s talking to me like, So, what do you do in Iran? Oh you’re a student, that’s fantastic. How are your studies going?

That night, I’m visited by somebody who describes himself as a judge. How long have you been here? I said 20 days. Oh ok, you’ll be out soon. What? No. Please don’t give me hope. And he goes, You’ll be out soon … Inshallah. And I’m like, oh, I won’t be out soon. That pause nearly killed me.

I was not physically abused. I was roughed up once. It was all mental games, which itself is extremely destructive, starting with the biggest question: When am I leaving here? I passed the time by exercising. By the end of it, I was doing something like 1,500 sit-ups and 400 pushups a day. Something absurd. I lost six kilos (13 pounds).

Day 28. They had a little sheet of rules printed and taped in your cell. According to Rule 9, I’m allowed to talk to my family every 15 days. I spoke with my mother again.

Day 29. I was moved out of solitary and put in another cell twice the size with two men—one said he had shared a cell with Jason. It occurred to me that I’m in a building full of intellectuals, dissidents, artists. There is a mini fridge and a television, but you get only state programming. We watched a sitcom about four guys in prison.

Day 31. I met the Swiss diplomats for the first time. Well, this is all a violation of the Geneva Convention and will be duly noted, one diplomat said. My interrogator shot back with something about Iranians being held in American prisons. The Swiss, veterans of these visits, were keen to assess my mental state. I was handed a Toblerone bar and a bunch of oranges, none of which made it to my cell.

I tracked the days with the paper money they let me keep. Every 15 days, someone would come around and ask if I wanted to buy anything from the store, like chocolate milk or apple juice. I would lay these all out, facing up for the first week. After a day would pass, I’d wake up and get to turn one over. There were 10 there and I’d think about how many sets of 10 I could get through. When they’re all face down, that’s 10. When they’re all face up again, that’s 20. Then 30. Then 40.

Javier Sirvent for TIME

Day 41. The two hours before I left was the worst time of the whole ordeal. In the morning, I was taken into a busy building nearby, to another man who said he was a judge. He writes on a piece of paper for a long time and says, Sign here. I sign it and ask what it is. Bye-bye form. Back to my cell.

A half hour later, my interrogator takes me into a basement room, pitch dark. There’s a spotlight on me and that high-end camera again. The interrogator stands behind a white sheet, the camera operator wears a surgical mask. This is your last chance, this is your last opportunity … Why are you here? Tell the truth. He says that two more times.

I stand up. I’d never done that the whole time. I’ve said everything I have to say. He says: You’ve made a very bad decision.

I’m pulled outside the room and pushed up against the wall, then taken to a doctor, who checks my vitals and says, Azadi, Inshallah. I need it repeated. Freedom, God willing.

Twenty minutes later: Collect all your things. I walk to the end of the hall, five or six paces. I turn left and that’s the door. I turn right and I go back into solitary. These are extremely stressful steps. I was very aware of my breathing. The guy grabs me, then pulls me left. We go downstairs and he’s practically pushing me at this point. Out the door.

In a building across the street, I’m given my clothes, bag, wallet, computer, passport—almost everything I had on me when I was taken. I’m blindfolded and driven to the gate. When the blindfold comes back off, there’s a man in a pink tie and crisp suit. It’s the best thing I’d ever seen. Matt, we’ll go now. It’s 100 mph to the airport, where I’m told I’ve overstayed my visa and need to pay a fee. I hold up my right index finger, which still has an ink stamp from my last fingerprinting. Evin, I say. The official smiles kind of awkwardly and is like, You still have to pay.

Sign up for Inside TIME. Be the first to see the new cover of TIME and get our most compelling stories delivered straight to your inbox. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.