Robert Ashman, 49, appeared at a committal hearing before magistrates at Cheltenham, Gloucestershire.
The court was told how MP Nigel Jones was convinced that Mr Ashman tried to murder him and twisted the sword in an effort to worsen the injuries.
Mr Ashman, of Lansdown Place, Cheltenham, is charged with murdering Andrew Pennington and attempting to murder Mr Jones at the Liberal Democrat constituency office in the town on 28 January.
Reporting restrictions were lifted at the request of the defence.
Dennis Scully, prosecuting, said that before the attack Mr Ashman had visited his parents' house in Cheltenham, where he read the book Gray's Anatomy.
On leaving he picked up a Samurai sword without them knowing, he alleged.
Later that afternoon, Mr Ashman arrived at Mr Jones's constituency office, where Andrew Pennington invited him into the interview room.
There, Mr Jones, Mr Pennington and Mr Ashman discussed a continuing legal row he was having over the repossession of his former home, according to the prosecution.
Mr Scully said: "After about five minutes Mr Ashman began to ramble and spoke about a conspiracy between Cheltenham Borough Council and Lloyds TSB of which he was the victim."
He described how Mr Jones and Mr Pennington appealed for calm but Mr Ashman then opened his coat, drew the sword and told the MP: "I'll tell you what I am going to do."
He allegedly struck at Mr Jones, who deflected a blow from the sword and managed to escape.
Mr Pennington was found suffering from multiple fatal stab wounds to chest and back.
Twisted sword
In a statement read to the court Mr Jones said: "I am convinced Mr Ashman intended to kill me. I believe Mr Ashman thought he had stuck the sword in and was pulling it around to inflict more damage."
Mr Jones said he believed that Mr Ashman had visited his surgery between 50 and 100 times.
He said Mr Ashman could go for a year without visiting him but would then attend the surgery several times a month.
Mr Jones said: "I never experienced seeing him losing his temper. I am convinced I was the intended victim of the attack."
Magistrates adjourned the case until Thursday.