The mother, named as 20-year-old Javaher Rezai, has been granted temporary residency through the so-called gymnasielag or 'upper secondary school law', according to reports in Swedish media.
This law offers some young asylum seekers a temporary permit to stay in Sweden to finish their studies at school, even if they have been denied asylum.
But her sons, aged five years and just five months, have been ordered to return to Afghanistan with their father, a country neither of the children have ever been to.
Rezai lives in Lessebo, southern Sweden, with her 24-year-old husband and the two boys, the youngest of whom was born in Sweden last December.
According to Rezai, she had to flee her native Afghanistan to Iran in order to avoid marrying a man her family had chosen for her. After several years in Iran, during which time she met her husband and gave birth to their elder son, the couple decided to move to Sweden for a more secure life.
- Deportations to Afghanistan go ahead after mass protest
- 'Those who manage to get out of Afghanistan should be given the benefit of the doubt'
- How herding endangered goats helps young Afghan asylum seekers in Sweden
“We thought that Sweden would give us peace; I thought we would get a more stable life here,” Rezai told the Expressen tabloid.
After arriving in Sweden in 2015, at first the whole family had their applications for residency rejected, but they appealed the decision. After the upper secondary school law came into effect last July, Rezai was granted a temporary permit to remain in Sweden for 13 months, up until mid-December 2019.
Her husband and young sons, however, have been given only four weeks to leave the country.
“I was really sad. It was strange to me. I didn't think they would expel my children while I was studying,” the mother told Expressen.
She also expressed fears for hers and her family's safety following any return to Afghanistan, telling the newspaper: “My family in Afghanistan do not know where I am and I fear what would happen if I went back there. I am scared and do not dare to return.”