On an August day four years ago, Swedish chemistry professor Charlotta Turner received a surprising text message that would change the life of one of her graduate students.

Firas Jumaah had returned to his native Iraq days earlier, fearing for the safety of his wife and two children who had traveled there for a family wedding. He had initially stayed behind to complete his lab work at Lund University in southern Sweden.

While with his family in Iraq, Jumaah sent his supervisor a text message asking her to remove him from the doctoral program if he wasn’t back in Sweden within a week.

Firas Jumaah Charlotta Turner

Surprised by the message, Turner, 48, called Jumaah. It was then that she found out that his family was facing a life-and-death situation.

“He was very sad and crying,” Turner told NBC News. “I could hear that the situation was hopeless and they had to flee.”

Jumaah's family had returned to visit their home country of Iraq before violence began. But while he was there the so-called Islamic State conducted a deadly offensive in northern Iraq.

On Aug. 3, ISIS attacked the city of Sinjar near to where Jumaah’s family was, massacring and enslaving thousands of Yazidis — a religious minority to which Jumaah and his family belong.

“He realized one day that things were getting really serious there,” Turner said. “He was very worried and he just left.”

Jumaah’s plan was to go in and bring his family back to Sweden, but when he arrived, most borders were closed because of a mass exodus of refugees. He also couldn’t go back to the airport. So they waited.

But the situation only grew worse because ISIS kept advancing — and, at one point, came within 12 miles of their house.

Over the phone, Jumaah told Turner that he and his family were preparing to go into hiding in Iraq’s northern mountains. She told him not to give up and started looking for ways to rescue the family.

“It was very spontaneous,” she said. “For me, it was obvious that I should help and bring them home.”

She approached the university’s security chief at the time, who found a company that could go in with armed men and rescue Jumaah and his family.