Moroccan director Maryam Touzani, whose is sophomore feature, “The Blue Caftan,” unspools in Un Certain Regard, has never been afraid to tackle topics that shatter her country’s social conventions.

She’s made a doc about Morocco’s female prostitutes that sparked plenty of attention and a short about the exploitation of children as domestic workers. Her first feature, “Adam,” looked at the plight of single mothers (it also screened in Un Certain Regard).

In “Blue Caftan” Touzani turns her gaze on the concealed homosexuality of a married man in Morocco where, in accordance with Islamic laws and customs, same-sex sexual activity is illegal and can be punished with imprisonment.

The film stars Lubna Azabal (“Adam”) and Saleh Bakri (“Costa Brava, Lebanon”) as Mina and Halim, a married couple who run a traditional caftan store in one of Morocco’s oldest medinas, or “old towns,” in the city of Salè. To keep up with demand, they hire Youssef (newcomer Ayoub Messioui), a talented apprentice whom Halim takes under his wing. Slowly, Mina, whose health is deteriorating, realizes how much her husband is taken by the presence of this young man.

Touzani says the film’s story was triggered by a chance encounter she made while scouting in the medina for “Adam.” She met a man “who reminded me of a lot of things I had heard in my childhood about men who were married and who were gay, and had to hide their homosexuality,” she says.

As a child she never really grasped what this meant. “It was always half murmured,” Touzani recalls.

Only later she fully understood the implications of being gay in Morocco.

Meeting this man she realized “there was something I thought was very violent in the way that I imagined he had to live his life,” she says. “To be someone that he wasn’t entirely, and be forced to maintain this facade in order to survive in this society.”

She knew that the fact that he would be portraying a gay man was not something to be taken lightly when she approached Palestinian actor Bakri about the role.

“This is an extremely sensitive subject in the Arab world where playing a character like Halim is really making a statement,” says Touzani. “You have to be really sure of your convictions in order to do it. It was an act of courage.”

That said, “Blue Caftan,” which also reflects the director’s love for Moroccan crafts and “all these things that are part of our DNA and are disappearing,” is a very nuanced film that aims to transcend its locally transgressive aspect.

It’s “a love story in the broadest sense,” the director points out, because Halim and Mina are a heterosexual couple who love each other and Mina is a Muslim woman who encourages her husband to be who he really is.

“She’s a very strong female character,” says Touzani. And very religious, although “her religion and her faith do not get in the way.”

Since Mina loves her husband, she understands him and wants him to be a man who accepts who he is.

“She’s redefining her faith just as they are redefining their love,” Touzani notes.

So will “Blue Caftan” play in Morocco?

Interestingly, the film’s script was submitted to the Moroccan Center for Cinematography and approved for support by an independent commission, “even though they knew it’s controversial,” says Touzani.

“Blue Caftan” was also shot in the Salè Medina, though this was “like walking on egg shells” and certain scenes had to be shot quickly.

Touzani says she now has hope that the film will be shown in Morocco. “It would be hard for me not to,” she adds, because she believes “Blue Caftan” “can bring this subject into the spotlight and help bring about debate and change.”

“There is something very beautiful about tradition,” she says. “But there are things in tradition that have to be questioned and shaken and that’s why it’s important to be able to look at tradition with different eyes.”