Image copyright Yoni Brook Image caption Barkhad Abdirahman plays Adan, a young Somali man living in the Cedar-Riverside neighbourhood of Minneapolis, Minnesota

In the largest Somali-American community in the US, residents say they are only portrayed on film as terrorists, pirates and soldiers. A new film tries to challenge those stereotypes.

When independent film director Musa Syeed began travelling from his home in New York City to the heart of the Somali community in Minneapolis, Minnesota, he started to hear a recurring complaint.

"You'll see news cameras come in and set up on the soccer field and shoot something without permission," Syeed says local teenagers told him. The shots would wind up in a piece about terrorism.

"There was a lot of distrust in media and the way their images have been used."

As a Muslim of Kashmiri descent who grew up in a small town in Indiana, Syeed was used to being a "hyper-visible" minority in a majority Caucasian place.

He first got interested in Somali culture when a few families moved to his community.

And Syeed noticed how they were treated differently not only for being Muslim, but for being black.

As an adult he saw those same struggles playing out in Minnesota, which is overwhelmingly white but also home to the largest Somali population in North America.

Not only do Minnesotan Somalis deal with the fact that they are in the religious and racial minority, they are also the focus of the federal government's war on terror.

The FBI says that of the 30,000 Somalis living in the region, at least 20 Somali men and women have successfully travelled abroad from Minnesota to join IS since 2014.

Another nine have been charged for attempting to join IS, and the ensuing trial for three of the men created a frenzy of national media attention.

As a result, the rest of the community feels increasingly maligned and marginalised.

"When I was growing up, people were saying ignorant things every once in a while, small-time bullying," says Syeed.

"But for [Somali-Americans] it's a different sort of structural, systemic discrimination."

Media playback is unsupported on your device Media caption How are American Muslims feeling ahead of the vote?

Somalis in Minnesota have already faced backlash, from an attack on a woman in a restaurant for speaking Swahili, to the circuit of anti-Islamic speakers who travel the state warning that refugees like Somalis or Syrians will someday attack a local city.

In another Midwestern state, Kansas, three men were recently arrested for plotting to bomb an apartment complex with a high Somali population in Garden City.

Beginning in January 2015, Syeed started visiting the heavily Somali-populated neighbourhood of Cedar-Riverside in Minneapolis, hoping to make a coming-of-age film about growing up Muslim in the American Midwest.

He went to prayers at the local mosque, to community dinners, to art shows.

He gave a filmmaking workshop for local teenagers.

Ifrah Mansour, an actress, playwright and artist, is used to turning down requests from writers or journalists who want to use her as a gateway into the community.

"They're not interested in sort of developing the work with sort of the cultural knowledge, the know-how that an individual from the community has," she says.

Syeed was different.

"Musa was interested in telling the Somali narrative with Somalis," she says.

Syeed's film, A Stray, tells the story of a Somali teenager named Adan - played by Barkhad Abdirahman - growing up in Minneapolis.

Adan lost his father in the war in Somalia, and his mother has kicked him out of their apartment for stealing her jewellery.

"You're a Somali and a Muslim, no one's gonna hire you," one of Adan's friends muses at one point in the film.

Unemployment in the Cedar-Riverside neighbourhood is estimated at 17.5%, compared with 4% citywide.

The teenager inadvertently becomes the caretaker for a stray dog named Layla.

Many Muslims believe keeping a dog is forbidden - in the film, taking in Layla costs Adan a job as well as his temporary home sleeping in the basement of his mosque.

The film debuted at South by Southwest, then Syeed returned to Cedar-Riverside and screened the finished product at a local community centre.

The majority of the dialogue is in Somali, with English subtitles.

Syeed wrote the script in English and allowed his actors to translate their lines into Somali, which led to some improvising as well as jokes and cultural references that only a person from the Somali culture would understand.

"To watch it with Somali people and finally laugh at these jokes in Somali... it felt like the film was really for us," says Mansour, who also had a small role.

Image copyright Yoni Brook Image caption In A Stray, the character Adan is a troubled Somali teenager who inadvertently becomes the owner of a stray dog

Compare that reaction with the one a new HBO series got when it came to shoot its pilot episode this fall.

According to Abdi Mohamed, a community activist and aspiring filmmaker, rumours that the project was called The Recruiters fuelled concern that the community would only be portrayed as extremists.

The real name of the series is Mogadishu, Minnesota, the brainchild of Somali-Canadian rapper K'naan.

While K'naan says his goal is to portray the lives of immigrant families, he was essentially driven off-stage at a block party in Minneapolis by protesters holding signs that read, "Stop Exploiting the Somali Community".

Residents of a housing complex with a high proportion of Somali residents unanimously voted to reject HBO's application to film parts of the series there.

Mohamed says the growing youth movement in the Somali community draws a direct connection between the portrayal of Minnesota's Somalis and discrimination.

They don't want to see their culture's representation on the big screen limited to terrorists and pirates - the Tom Hanks film Captain Phillips cast many of its pirates in Minneapolis.

"All these reports in the news, people think to themselves, 'The Somali community is very isolated, they're not adapting,' which is far from the truth," he says.

"What Musa Syeed did, he went into the community. He talked to people here.

"He made it a story about a young Somali man with very relatable issues, very relatable things he was going through."

Syeed's film does not completely ignore the issue of terrorism - an FBI agent seems to be lurking at every turn, hoping to turn Adan into an informant.

But by showing life for refugees in Minnesota as nuanced, troubled but also beautiful, Syeed hopes it will encourage more people to interact with the community.

"Some people in Minnesota have this idea that [Somali] communities are no-go zones or you're not welcome there," says Syeed.

"People in the Twin Cities should explore and go have dinner at Somali restaurant or go visit a mosque... if people want to make that sincere connection, there's ways to do that."

The film is currently screening in New York and Minneapolis, then it will head to London's Film Africa festival next week.