A “manipulative” teenage boy accused of raping and stabbing his 16-year-old ex-girlfriend to prove his love for his new partner installed his own fingerprint on his victim’s phone and took control of her social media accounts, a court has heard.

The 17-year-old boy from Greater Manchester, who cannot be named, had been in a “coercive” and controlling relationship with his alleged victim for two and a half years when he almost killed her this May, a jury at Manchester crown court was told.

Giving evidence against the boy on Thursday, the girl said he banned her from wearing certain things and that it was a “problem” if she wanted to go out wearing makeup. She claimed he made her give him passwords for her social media accounts, including Instagram and Snapchat, and programmed his own fingerprint into her mobile “so that he could access my phone whenever he felt like it”.

The couple had an unplanned baby together before the attack and he would call her a “slut”, a “sket” and a “shit mum”, she said, choosing to give evidence in open court rather than behind a screen.

The boy denies attempted murder but has admitted stabbing his ex and causing her grievous bodily harm (GBH). He has also pleaded not guilty to raping her just before the attack, insisting that the sex was consensual.

A 17-year-old girl is on trial with him, accused of encouraging him to commit murder or GBH after texting him during the attack asking him to film it. The prosecution say she egged him on to “prove” that he loved her and bought the Dettol wipes with which he cleaned the knife.

The court heard that she was jealous and shortly before the attack dumped the boy after someone had sent her a picture on social media of him and his ex at the Trafford Centre, suggesting he was being unfaithful. After the attack, the boy texted her to say: “I did it to prove I love you … There was no other way to keep you.”

Her barrister, Peter Wright, QC, cross-examined the complainant on Thursday, discussing how the boy had previously hurt other girls.

They discussed messages the boy sent her in January this year in which he suggested he was going to wear a mask to “scare” with a “fake knife” another girl who had suggested he was going to be a bad father.

Wright suggested the complainant had encouraged the boy to frighten another of her friends in March, shortly after she gave birth to their baby. He read out texts in which she told him where her friend would be at a particular time and warned: “Make sure you don’t look like you.” In another message, she declared the two “partners in crime”. Giving evidence, the complainant said she was frightened that he would try to gain custody of their child if she didn’t comply with his wishes.

The girl also told the court that as he stabbed her he told her he would “get” their child. “My baby was something he knew he had power over, because he’s the father. If I didn’t listen to him, my son is gone,” she said.

She agreed when Wright said the boy was “manipulative”, “unreliable”, “deceitful” and “coercive: he would put pressure on you to do what he wanted you to do”.

The court heard how she even agreed to fake her own death so that he could take a picture of her shortly before the attack.

Questioned by the boy’s barrister, Simon Csoka QC, the girl said that the boy changed when he started seeing his new partner, around the time she found out she was pregnant. “Before she was in the picture, [he] was a normal kid,” she said.

The case continues.