The court heard Miss Clarke, who was 26 weeks pregnant at the time, was at the house when an argument broke out with Mahmood.
Prosecutor Dale Sullivan said: "He was denying being the father of the soon-to-be-born child. A DNA test was discussed."
Following the argument Miss Clarke, 24, ordered a taxi to go home and Mahmood lashed out.
Mr Sullivan added: "She describes the defendant coming from behind her and he pulled a knife. He approached her telling her not to scream and stabbed her in the neck.
"Miss Clarke remembers bending over in an attempt to protect her baby when she was stabbed again near her shoulder and elbow.
"She wrapped herself in a curtain and made her escape."I won't indulge my inner Mrs Merton by wondering what it was that first attracted Stacey to mentally-fragile Mahmood...
Mahmood was sectioned to a secure unit under the Mental Health Act.
Judge David Rennie added that Mahmood will only be released, if ever, after consideration by the Secretary of State.I wonder if Stacey will be waiting..?