The election of a Conservative MP could have been declared void if he had filed accurate returns that showed he had overspent on his campaign to beat Nigel Farage, a court has heard.

Craig Mackinlay, an accountant, stands accused along with his election agent and a party official of deliberately submitting “woefully inaccurate” expenditure returns.

The prosecution alleges that Mackinlay, 52, alongside Nathan Gray, 29, and Marion Little, 63, may have spent more than double the legal limit.

Their trial at Southwark crown court in London has heard the Conservative party put in extra resources to win the South Thanet seat at the 2015 general election, in a “two-horse race” with Farage, who was then the leader of Ukip.

Declared spending on the campaign came in under the £52,000 limit set for the Kent constituency, but prosecutors allege up to £66,600 of extra expenditure was not declared.

Aftab Jafferjee QC, for the prosecution, told jurors on Wednesday that Mackinlay had to be elected to satisfy the national party’s officials. “In seeking to ensure the success of the Conservative party’s candidate and the defeat of Nigel Farage, we submit that proper regard to the limits of expenditure imposed by law was simply abandoned,” he said.

“Each of these three defendants were complicit in the means deployed to achieve that end. Had the true position been declared, Craig Mackinlay’s election would have been at the risk of being declared void.”

Mackinlay won the seat with a majority of about 2,800.

In a police interview, the MP, who has been in politics for more than 20 years, attempted to “distance himself from Conservative campaign headquarters staff and volunteers drafted in to help with his campaign”, the court heard, despite being “fully aware” of their assistance.

Prosecutors allege that in addition to undeclared extra money spent on staffing, accommodation, advertising, posters and a bus for Mackinlay’s campaign, the returns also failed to take into account thousands of pounds that should have paid for staffing costs. The prosecution claims these costs were covered mainly by the Conservative party’s central funds.

The court heard that the defendants were warned about the risk of overspending in February 2015. Anthony Salter, an experienced activist of 50 years who was the acting chair of the campaign team in Thanet until March 2015, sent an email to Little that said: “We face a real prospect of a legal challenge from Farage if we make the smallest slip-up.”

Salter told the jury that about a third of South Thanet Conservative voters had defected to Ukip – the Tories had approximately 20,000 Conservatives listed on its database but 7,000 of those had switched to supporting Ukip.

“A constituency opinion poll done in August [2014] found that about a third of Conservative voters had defected to Ukip,” he said.

Salter, who stood as a Conservative candidate in Woolwich in 1987, said there was tension between the local party and national headquarters that heightened after the arrival of Little in March 2015.

Salter had told Little, who worked for the Conservative campaign’s central office, they were getting “perilously close” to hitting the legal spending limit, jurors heard. “Relationships between South Thanet and Conservative central office had always been somewhat difficult,” said Salter.

He told the jury he was concerned that Gray had not been adequately prepared to deal with the election agent duties. Jafferjee asked: “You had some reservations about the appropriate level of training?”

Salter replied: “In so far as he [Gray] was to be the election agent, I did not consider that he had the appropriate level of training and expertise. I wanted somebody with proper training and expertise to oversee and make sure we didn’t make stupid mistakes.”

Salter said Little in effect took over his role without any formal discussion. This became apparent when Salter returned to the campaign offices in South Thanet to find that someone, he presumed Little, had replaced his maps and election charts from the wall of the campaign office.

“It seemed to me, in a very English way, that Marion had taken over control of the campaign, ie that there was no confrontation.” Asked whether they had discussed Little’s salary in relation to campaign expenses, he replied: “I do not recall any discussion about her costs.”

Salter said he also had reservations about Gray’s employment by CCHQ as the election agent. “I wanted somebody with the proper training and expertise to oversee [the expenditure returns] and make sure we didn’t make stupid mistakes,” he said.

Trevor Burke QC, defending Gray, suggested his client was regarded as an “idiot” in the campaign office by colleagues who talked about him behind his back. “For some in the office there was a general perception he couldn’t put his trousers on in the morning without the help of someone else,” he said to the witness.

Salter replied: “It was never expressed to me while I was down there, it was expressed to me subsequently.”

Mackinlay denies two charges of making a false election expenses declaration. Gray denies one charge of making a false election expenses declaration and a further charge of using a false instrument. Little denies three counts of intentionally encouraging or assisting an offence under the 2007 Serious Crime Act.

The trial continues.