Cranog Jones, 44, said he lied about visiting a tip to dump piping, which the prosecution alleges was to be used to gas her. At first he denied visiting the tip, but later said he had driven there but had not left his car.
Mr Jones told Winchester Crown Court, Hampshire, that a month later he went to the police and admitted lying because he thought his wife was trying to set him up. He said: 'I feel heartily ashamed of myself given my position as a magistrate.'
He added: 'My wife had vowed to destroy me, my job and my position as a magistrate . . . I believed she was trying to set me up. My interpretation of what she was saying was that I had placed a pipe through a hole and intended to fill the room with gas. Getting rid of the pipes was a precautionary move.'
Asked why his wife was so upset when she called at a neighbour's house on the morning of the alleged murder attempt, Mr Jones said: 'No idea.' Mr Jones, of Wymans Brook, Cheltenham, Gloucestershire, denies attempting to murder Margaret Jones, 43, at Brockhampton, Gloucestershire, in December 1991.
The prosecution claims that he planned to attach piping from his car to a box which he would put over her head to poison her and then pretend she had committed suicide.
Christopher Clark QC, making his closing speech for the prosecution, said the jury had to decide whether Mrs Jones was telling the truth or was 'a dreamer who concocted a story to force her husband from their house'. He added: 'If so, what an extraordinary story . . . If she wanted to make up a story that her husband had tried to kill her, why didn't she say he had come at her brandishing a carving knife . . . or say that he tried to suffocate or strangle her?'
Mr Clark said Mr Jones's story that he had drilled a hole in the bedroom wall to install a sink as a birthday surprise was 'absurd' and that it was unbelievable he had gassed his daughter's kitten by accident.
Michael Parroy QC, for the defence, said Mrs Jones 'was not quite the easygoing, friendly housewife she would have you believe'. He said that if Mr Jones had wanted to kill his wife by gassing her with exhaust fumes while she slept, he would have put pipes through the bedroom window.
The trial continues today.