Ramanodge Unmathallegado, 51, wrought a "violent revenge" on his ex-wife after she left him for another man, moved him into their family home and converted to Islam, changing her name to Sana Mohammed.
A jury at the Old Bailey in central London heard Unmathallegado, armed with two loaded crossbows, hid in a shed at the bottom of the garden of the house in Ilford and lay in wait.
Peter Wright, QC, prosecuting, said Unmathallegado was waiting until his own three children — who ranged in age from 12 to 17 — left to go to school.
But by chance at 7.30am, 20 minutes before the children were due to leave for school, his wife's new husband, Imtiaz Mohammed, walked down to the shed to put a box into storage.
Mr Wright said Unmathallegado chased Mr Mohammed into the house and then turned his attention to his ex-wife, who was running up the stairs.
He said the defendant fired one of the crossbows into his ex-wife's abdomen and she fell to the ground.
"It caused catastrophic injuries and pierced her heart. She was heavily pregnant and her expected date of confinement was just a month away. Desperate efforts were made to save her and the baby. Later that day a baby son was delivered by emergency Caesarean, but she died of her injuries," Mr Wright told the jury.
Disarmed By His Sons
Unmathallegado's sons then disarmed him, said Mr Wright.
"It would have been OK if you guys weren't here," Unmathallegado reportedly told his sons in the immediate aftermath of the incident.
Unmathallegado denies murder and attempted child destruction.
"For at least a year he had been making preparations for an attack on Devi and Imtiaz. It was the culmination of a series of acts. It was a devastating and murderous attack on his former wife and her new partner," Mr Wright told the court.
"This was a quite deliberate and calculated act of revenge, intended to cause at the very least the death of Devi and the extinction of the child she was carrying," Mr Wright said.
Mr Wright said the couple had an arranged marriage in their native Mauritius in 1999, when Devi was 16 and her husband 32.
They married two weeks after being introduced by their parents.
Mr Wright said the couple moved to the UK in 2001 and he began working as a site manager at Newham Hospital.
They had three children together but Mr Wright said the relationship deteriorated every time she got pregnant, with her husband retreating to his room.
Mr Wright said Devi was miserable in the marriage and asked him for a divorce several times.
In 2011 she confided in Imtiaz Mohammed, a neighbour who was decorating their kitchen, and they began an affair.
Mr Mohammed was already married with a wife and child in Pakistan.
In March 2012 Devi jumped from a first floor bedroom of the house and broke her foot but her husband was acquitted of harming her.
But while he was in custody on remand Mr Mohammed moved into the house and the couple had a Muslim marriage in June 2012, when she converted to Islam.
At one point Unmathallegado burst into tears and begged her to come back to him.
Devi had two children with Imtiaz and got pregnant again in the spring of 2018. She was due to give birth on 13 December.
Mr Wright said the Unmathallegados eventually got divorced in 2014 and Ramanodge rapidly "disintegrated".
Defendant Lost Job and Became Homeless After Divorce
He resigned from his job at the hospital and according to a friend and former work colleague, Ali Kinteh, he became more unkempt and dirty and gave the appearance he was homeless.
The prosecution claim the defendant amassed several "caches" of weapons and surveillance equipment, which he hid at the back of an electricity sub-station close to his wife's house. They included stepladders, binoculars and cable ties.
Mr Wright said the defendant repeatedly hung around near the house, springing "from nowhere" to ask "strange questions" of his children as they walked to school.
One of the questions he asked was whether the garden shed was kept locked, said Mr Wright.
Mr Wright said both of Unmathallegado's sons would be giving evidence by video for the prosecution about what they saw on 12 November 2018 and the events leading up to that day.
The trial continues.