Court documents obtained by ABC News show Australian teacher Gabrielle Maina, who was shot dead in Kenya, feared for her safety and accused her husband Cyrus Maina of psychological torture.

Ms Maina, 40, was shot dead while walking near her home in Nairobi, on October 19 last year.

Mr Maina and his cousin John Njuguna Waithira were arrested in connection with the killing, but were released without charge a week later, because there was no evidence against them.

Both men said they were innocent and had no involvement in the murder.

Police are still investigating whether the shooting was a random robbery or a targeted killing.

Ms Maina was granted a restraining order against her husband in April 2017 — six months before she was murdered.

In an affidavit lodged with the Chief Magistrate's Court in Nairobi, she alleged her husband "became extremely violent and was of uncontrollable anger" after they moved from Australia to Kenya with their two sons in 2016.

"He totally withdrew his companionship and as a resort (sic) I have suffered mentally and psychologically … to escape the abusive relationship and to feel more secure I sought an alternative accommodation away from the Respondent."

— Gabrielle Maina, affidavit to Chief Magistrate's Court, Nairobi, April 13, 2017.

"... The Respondent has continued contacting, calling, sending messages, stalking threatening, harassing and disturbing my peace … these actions by the Respondent have subjected me to humiliation and a credible threat of ruining my life and as such, I am afraid for my safety … the Respondent's actions have caused me and my family, untold anguish, psychological torture and trauma."

— Gabrielle Maina, affidavit to Chief Magistrate's Court, Nairobi, April 13, 2017.

Ms Maina's lawyer, George King'ori, lodged a certificate of urgency on Ms Maina's behalf to obtain a restraining order against Mr Maina, alleging: "The Respondent who is the estranged husband of the Applicant has uncontrollable anger and irrational behaviour. The Respondent has emotionally and psychologically abused the Applicant which is categorised as a form of domestic violence …"

"The Applicant is a victim of domestic violence and is seeking protection under the Protection against domestic Violence Act, 2015 …"

— Application for Certificate of Urgency, Chief Magistrate's Court, Nairobi, April 13, 2017.

Gabrielle Maina's husband Cyrus lodged an affidavit with the court in August 2017, dismissing the allegations.

"… It is not in the least bit true that I became extremely violent or exhibited uncontrollable anger … it is actually the Petitioner who suddenly began distancing herself from me on or about August 2016."

"… Our relationship was never abusive and she actually asked me for a separation in November 2016, citing that she needed space. I wish to aver that I loved the Petitioner immensely and we were married for 16 years."

— Cyrus Maina affidavit to Chief Magistrate's Court, Nairobi, August 28th, 2017.

Mr Maina submitted to the court that his wife wanted to end the relationship — not him.

"… Her reason for her request for separation were solely the result of her having an affair with an ex-colleague at her work place."

"It has always been my desire to keep the family together and the breakdown of the marriage and by extension the family has caused me untold grief, turmoil and pain and I am surprised and saddened that the Petitioner has chosen to attribute the breakdown of the marriage to me."

"… In December 2016 I came across the Petitioner's journal which contained explicit details of her affair and when I confronted her about it, she admitted it.'

— Cyrus Maina affidavit to Chief Magistrate's Court, Nairobi, August 28th, 2017.

In the affidavit, Mr Maina said while he was angry about the breakdown of the marriage, he was not violent or threatening towards his wife.

"I did not at any point place any threats to the Petitioner nor did I loiter around her place causing unrest to her and my sons whom I love so deeply."

"… I categorically deny causing the Petitioner and any of her family members any form of anguish, psychological torture and drama."

"I am at a loss as to why the Petitioner would feel inclined to pray for a restraining order against me as I have not in any way presented a threat of violence."

— Cyrus Maina affidavit to Chief Magistrate's Court, Nairobi, August 28th, 2017.

ABC News requested an interview with Mr Maina, via his lawyer, Wilfred Nderitu.

Mr Nderitu declined the request on behalf of his client.

The police investigation into the killing is continuing.