The Ukip leader, Nigel Farage, got the tone of his comments “wrong on so many levels” when he spoke about wanting to ban foreigners with HIV from Britain, Douglas Carswell, the party’s only MP, has said.

Farage brought up the idea of stopping immigrants with life-threatening illnesses, including HIV, from entering the country during the first leaders’ television debate during the general election campaign. It later emerged this was part of a deliberate “shock and awe” strategy.

At the time, Carswell avoided backing Farage and criticised a reporter for “putting a slightly slanted question that will mean I have to answer it in a way that means I’m at odds with my party leader”.

“I’m not going to play that game,” he told the Telegraph. “I think it’s personally reasonable to want our national health service to be a national health service and not an international health service.”

However, Carswell has now revealed the extent of his unease about the remarks, telling BBC Radio 5 programme Pienaar’s Politics: “I think some of the tone we deployed, for example, the comments about HIV, were plain wrong. Wrong on so many levels. Not just wrong because they were electorally unhelpful, but wrong because they were wrong.”

He warned against framing the debate as “mean-spirited” as it could put off many potential Ukip voters who appreciate the fact that Britain is a generous place.

“Yes, there is a really important case to be made about restricting people’s right to come here and take advantage of our health service … but there is also something fundamentally generous about this country and I think we should always remember that.”

Carswell’s intervention came after about of infighting within Ukip in the wake of Farage’s election defeat in South Thanet and the loss of one of its two MPs.

A coup against Farage’s leadership was attempted after he stepped down only to reverse his decision four days later.

Carswell was one of those calling for Farage to take a break over the summer but he denied being one of the party figures who wanted the Ukip leader to step down completely over fears he was too divisive to lead its EU referendum “out” campaign.

The Ukip MP has, however, made it clear that he would prefer a non-political person, such as the businessman James Dyson, to spearhead the movement for the UK to leave the EU.

Asked about Carswell’s comments, a Ukip spokesman said: “The issue of health tourism is both real and costs the NHS millions per year. It is one of many problems that bedevil the NHS, and dealing with it, alongside many other problems is part of a greater package to ensure that the people of this country can access the world-class healthcare they both deserve and expect.”