Bill Walker said he was “in a state of upset” after Anne Gruber came at him with a four to six-inch-long blade.
He described how he wrestled her to the ground and prised the blade out of her hand during the 1984 incident, in which he said his tie was cut.
“I should have contacted the police,” the independent member for Dunfermline told Edinburgh Sheriff Court.
The 71-year-old is accused of a string of attacks against three former wives and a stepdaughter between 1967 and 1995. He denies all the charges.
Walker is alleged to have assaulted Mrs Gruber 15 times at various addresses in Edinburgh and Midlothian between 1978 and 1984.
Giving evidence for a second day at his trial before Sheriff Katherine Mackie, Walker outlined various stages in his relationship with Mrs Gruber, including several reconciliations and attempted reconciliations between them in the early to mid-1980s.
He told the court how the marriage broke down again in November 1984 “after one or two incidents”.
Questioned about those incidents, Walker told the court: “The most serious one, which Anne alluded to in an affidavit she submitted, was that she attacked me with a dagger.”
Recalling the alleged incident, he said Mrs Gruber “burst through” some double doors from the kitchen into the living room at their home and was “holding this dagger in her left hand”.
He said: “She walked towards me with the dagger at waist level, pointing it at me and advancing slowly towards me,” adding that she was telling him: “Keep away from me.”
He believed his wife had been drinking, Walker told the court.
“I managed to wrestle her to the floor. I don’t know whether I actually slapped her,” the MSP said.
Asked to go over the alleged incident for a second time in court, he told how he got the dagger off her while they were on the ground.
“She was holding it in a clench. I literally had to prise her fingers open. There was a hilt on it, the whole of the handle was in her hand and the blade was sticking forward.”
Walker then did “one of the most stupid things in my life” and threw out the dagger and tie.
Walker never got an explanation for the incident from his wife, he told the court.
The MSP denies 23 charges of assault and one breach of the peace. He has lodged special defences of self-defence in relation to three of the charges.
Walker also told the court about an earlier occasion when he claimed his second wife
approached him while he was with his children and said: “Don’t hit me, don’t hit me.”
He said he was “shocked” by the event, telling the court: “It seemed to be for the benefit of the children, that their father was some sort of bully.”
Questioned by his lawyer, solicitor advocate Gordon Martin, the MSP also denied assaulting his third wife in a lift in 1986.
He further denied throwing a tray at Diana Walker on a separate occasion and punching her in the face. He agreed that any claims to that effect were lies.
He felt “very hurt, very betrayed” after allegations against him were first published in a Sunday newspaper in March last year, the politician told the court.
“I’d been married three times,” he said. “The last two of my ex-wives, I felt they were possibly trying to score some points.”
He said he had not assaulted either woman.
The trial continues.