“The party leadership believes that having a mandate within the party and within Muslim civil society is incompatible. The party leadership's view isn't only regrettable, it's also a frightening signal to Muslims and other Social Democrats who are people of faith,” he wrote in an open letter.
“I therefore feel that the party leadership doesn't have confidence in me and have forced me to resign from all my duties in the party.”
Mustafa, 28, was chosen to sit on the governing board of the left-of-centre opposition party at last weekend's party congress.
The election has proven controversial, however, with much of the criticism concerning an invitation issued by the Islamic Association to speakers with known anti-Semitic views.
According to the TT news agency, the Islamic Association's bylaws also state that men and women have different legal status.
Mustafa's announcement came following a Saturday night crisis meeting among Social Democrats in Stockholm who had previously lobbied to have him included in the party's governing board.
“Knowing what we know now and considering how events unfolded, the situation became unsustainable. I therefore urged him to resign,” Veronica Palm, chair of the Social Democrats in Stockholm, told TT.
Palm explained that she and her colleagues had nominated Mustafa to the Social Democrats' governing board because he'd “done a good job” for the party in Stockholm.
“We thought he had valuable experience that could contribute to the party on a national level,” she said.
She added that the party was aware of the Islamic Association's views about women and the family, but explained that Mustafa “had never shown values other than those held by the Social Democrats”.
Earlier on Saturday, party leader Stefan Löfven had made it clear that, if he is to continue, Mustafa needed to fully get behind the party's values.
"You can't hold an elected position within the Social Democrats unless you can fully stand up for the party's values that all human beings are equal and for equality between women and men," Löfven said.
"These are the values which we base our whole political platform on. This is inviolable."
In his open letter, Mustafa explained that he had become the victim of “unfounded attacks and conspiracy theories about Islam, Muslims, and Muslim organizations”.
Despite leaving his duties with the party, Mustafa vowed to continue working within Muslim civil society for “justice, equality, and human rights.”
“I plan to continue my work with Swedish-Muslim identity, against racism in all its forms, and for a more just national and international policy,” he wrote.