When Katie Elfar's partner Karim was diagnosed with terminal cancer in 2009, she was devastated. Not only did she have to confront the loss of her partner but the couple's first child, Oscar, was just two weeks old. Her dreams for the future - a large, happy, rowdy family - were shattered.

But before doctors began aggressive treatment on Karim's cancer, the couple attended an in-vitro fertilisation clinic in Sydney. The couple had decided to conceive a second baby with Karim's frozen sperm.

IVF technology, which was first used successfully in the late 1970s, is not just for couples struggling with infertility. As long as a man consents, Australian law recognises a woman's right to have her dead partner's baby.

"I knew with all the treatment he wasn't going to be able to conceive naturally, even if he survived," says Katie. "He was happy because he knew what our plans were. [The first time] I fell pregnant naturally within a minute. So I thought it would be easy."

It wasn't. Seven months after her partner's diagnosis, Katie began fertility treatment. As she underwent cycle after cycle, 50-year-old Karim grew sicker. In February 2010, when he was given just two weeks to live, the couple married in a small ceremony in their courtyard.

Karim's cancer spread from his kidneys to his lymph nodes, then attacked his bones and bone marrow. Oscar learnt to crawl in the chemotherapy ward. Meanwhile, Katie's IVF treatment kept failing.

"Karim was very supportive, but he was in hospital all the time," says Katie, who works as a real estate administrator in North Sydney. "He wanted a family, but that wasn't his priority any more. He just wanted to get better, so I was doing the fertility treatment by myself."

A few weeks after Karim passed away in November that year, Katie discovered she was pregnant. Amid the grief, the new life gave her hope. But, tragically, the baby was born prematurely, at 23 weeks. Katie called him Karim. He lived for three hours and was buried with his father.

"I fell apart from there," says Katie, still overwhelmed by the trauma of the experience. "It was horrendous to bury my husband and my son within six months of each other. I don't think I left my house for a month. I didn't want to talk to anyone and I thought, 'I'm not going to do it again.' "

Time brought healing. Katie got a job and saw her old friends. She even tried dating, without success.

But her desire to have another baby - Karim's baby, a sibling for Oscar - was still strong.

On the first anniversary of her baby's death, Katie made an appointment at the fertility clinic. Her doctor gave the go-ahead but she was uncertain. Was she was strong enough? Was it the right time? She pulled out at the last moment.

Another year later, she took the plunge. The treatment worked first time. In February this year, Beau Eddy Karim Elfar was born.

"It was the best decision I ever made," she says. "I could have so easily not have gone down that path. I only had a few embryos left. Thank goodness I kept them."

Katie, 30, is aware of the enormity of her decision. Yes, she knows her son will never meet his father. Yes, she hopes she will meet someone someday. Yes, she is aware of the challenges of raising two boys alone. "I feel so blessed and so thankful that we live in a time where we are able to do this," she says. "I feel so lucky to carry on our family because it was what Karim wanted, too. I would have given anything for Karim to share it with me, but I wasn't scared to do it on my own because I'd always been a single mother. Karim was around when Oscar was born but he was too sick to help."

Stories such as Katie Elfar's are rare. Gavin Sacks, clinical director of IVF Australia and Katie's doctor, says there are only a handful of similar cases in Australia. The reason? Simple statistics. Few people die during their child-bearing years. But there is also a larger ethical question. Is it right to conceive a child who will never know its father?

"It's an amazing thing for Katie to have gone through and our job is to support people in their decision," says Sacks. "But you have to say, 'Is this really what you want?'

"You have to question this every time. You are bringing someone into the world and it may affect the new person and the mother herself.

"Ultimately it is her choice. Whatever they had together must have been so powerful. And also, she wanted to make a true sibling for her eldest child. She's actually created two children who can support each other and it gives her strength to find new life herself. It's a very individualised thing but she's been very determined and we've grown to appreciate that in her."

In Katie's case, the law was clear. Karim consented to his sperm being used after his death. But in cases where a man dies suddenly, his partner is usually forced to take her battle to court.

"The general principle is that sperm should not be used in reproductive treatment after a man has died, without his written consent," says Professor Loane Skene, a medico-legal expert at Melbourne Law School.

"A man may be willing to have a child by reproductive technology while he is alive but be less willing, or even object to, having a child who is conceived and born posthumously."

Despite that, the courts have been remarkably understanding. In 2011, Sydney woman Jocelyn Edwards was granted access to her dead husband's sperm because they had planned to sign IVF consent forms a day after he died in a workplace accident. Last year, a South Australian woman was allowed to take sperm from her husband who had died in a car accident because she could prove they'd planned to start a family.

This approach has been echoed overseas. In March, a 28-year-old widow from Birmingham in Britain won her High Court fight to have her late husband's sperm stored long-term, challenging an IVF regulation that would have forced to her use it within a year.

Commentators praised the decision. Journalist Ally Fogg wrote in The Guardian: "As a society we have long accepted a mother's right to decide to carry and raise a child alone ... It seems clear that any child born out of this decision will be brought into the world with love, devotion, caution and care, and that is a pretty damned good start in life for anyone."

For Katie, there are moments of heartbreak and sadness. But most of all, she feels overwhelming joy. "Beau looks exactly like Karim," she says. "It's the icing on the cake. Karim would have been absolutely overjoyed."