Claire Danes has responded to claims that Homeland is “racist” and “Islamophobic”, as the political thriller reaches the end of its eighth and final series.

Homeland has had a mixed reception since it launched in 2011. While its first series was a critical triumph, gained fans including Barack Obama and won many Emmy awards, the show has also been accused of being “bigoted”.

Writer and filmmaker Laura Durkay wrote in the Washington Post in 2014: “Since its first episode, Homeland has churned out Islamophobic stereotypes as if its writers were getting paid by the cliche.”

The following year, Arab graffiti artists who had been hired by producers to make a Syrian refugee camp look more authentic, secretly wrote: “Homeland is racist.” No one noticed until the episode was broadcast.

In a rare interview with The Guardian, Danes said: “That was a good stunt. All of our hats were off to them.”

On the broader issue of racism in the show, she added: “I get it. I think it’s tricky and kind of inherently problematic, right? There are a lot of brown people in our story who are doing really bad things, and there aren’t enough opportunities to create a more balanced portrait of that demographic.

“That was always going to be a point of vulnerability for us, but I also think that our heroes are really problematic and really flawed. We’re wrestling with some pretty challenging questions and ideas and those two sides of various arguments were personified by our characters.”

She continued: “In most cases I think both characters were right. Our writers were fairly responsible about that, creating a real debate. In the first episode of this season we have the Palestinian politician who’s really challenging Saul and making credible, cogent points about the ways that America has failed. I was happy about that at least.”

The first episode of Homeland season eight was given three stars by The Independent’s critic Ed Cumming, who said “all its life” comes from Danes and her performance as CIA operative Carrie Mathison.