A Conservative candidate has apologised for telling a Scottish schoolgirl to “fuck off” after she said she would vote for independence if there was a second referendum.

James Heappey, who is standing for re-election in Wells, made the remark during a debate with sixth-formers at the fee-paying Millfield school in Somerset.

Heappey said his comment was intended to be light-hearted and denied reports that he told the teenager to “fuck off back to Scotland”.

In a statement he said: “I made a comment – intended only as a joke – but it was inappropriate and I am deeply sorry for any offence caused. I wrote to [the pupil] soon after the school brought her concerns to my attention and apologised unreservedly.”

The girl is understood to have raised the incident with her father – believed to be a Scottish National party supporter – who contacted the school.

Wells is an important battleground constituency for the Tories, who are trying to fight off a challenge from the former Liberal Democrat MP Tessa Munt. The Lib Dem leader, Tim Farron, was in the constituency helping Munt campaign last week.

Munt said she was shocked by Heappey’s remarks, which were made in March before the election was called while he was the area’s MP.

Munt said: “School is meant to be a safe place. We send our children to school in the expectation that they will be treated fairly and with respect by people in positions of power.

“I am utterly shocked that the then MP has used bullying, racist and abusive language to dismiss a teenage schoolgirl engaging in political debate.”

Heappey, a former army major, defeated Munt at the 2015 election. Munt’s campaign has been boosted by a win in the local elections this month when she took the Wells seat from the county council leader John Osman.

The SNP has called for the Tories to suspend Heappey. The SNP candidate for Glasgow North West, Carol Monaghan, said: “This type of comment reflects the unpleasant attitudes at the very heart of the Tory party – and it sadly isn’t the first time these kind of attitudes have come to light.

“For a candidate to make this kind of remark, especially to a schoolgirl, is absolutely disgraceful – and the Tories should suspend Mr Heappey as a candidate. Mr Heappey’s protests about it being a joke just don’t cut it. This sort of offensive and abusive language has no place in our politics.”

