PARK CITY, Utah — Kristen Stewart takes a lot of abuse in her latest film, a gritty drama about detainees at Guantanamo Bay.

“Camp X-Ray,” which premiered Friday at the Sundance Film Festival to boisterous applause, features Stewart as Amy Cole, a guard stationed at the controversial U.S. prison in Cuba, where suspected terrorists are being detained. Stewart’s character takes an elbow to the face, is spit on and splattered with excrement, but learns her treatment is nothing compared to the detainees.

The movie is sympathetic to the prisoners’ plight; Stewart’s character eventually forms a bond with innocent inmate Ali Amir, played by Peyman Moaadi.

In an interview with The Associated Press, Stewart said she relished playing such a strong character.

“It’s a movie about somebody who doesn’t seem made up. I read this thing and felt like I wanted to stand up for her. It felt really real to me and I felt like it was something that I was willing to do anything for,” she said in a phone interview last week. “I haven’t played too many parts that I feel like are really outside of myself. And it’s quiet and when something really quiet punches you in the stomach, that’s what I like to do.”

Stewart was on hand with the rest of the cast for the Sundance debut. After the film was shown, first-time filmmaker Peter Sattler told the audience that he got the inspiration for “Camp X-Ray” after watching documentary footage of a guard and a detainee talking about books on a library cart. In his film, the two main characters similarly bond over the prison’s book selection.

Sattler originally intended Stewart’s role for a male, but he shifted to a female lead because he felt it created more conflict between the two.

Lane Garrison, who also plays a guard in the movie, told the audience that working on “Camp X-Ray” shifted his thinking of Guantanamo Bay, which has been the center of a battle over whether it should close. President Barack Obama has said he would like to see it shut down.

“I had a belief that everyone down there was responsible for 9/11,” said Garrison. “After doing this film I started asking questions about Guantanamo Bay and come to find out that there are still men down there that no country wants and I started thinking ‘What if there is a guy down there that is innocent that’s not a terrorist — does he deserve that day in court? It changed me to start asking questions and not just go along with the flow.”

The film is a candidate in the festival’s U.S. dramatic competition. Winners will be announced on Jan. 25.