Media playback is unsupported on your device Media caption Panorama goes undercover to discover how so-called 'health tourists' buy access to free NHS services

The NHS has lost at least £40m in four years by failing to identify so-called "health tourists" accessing hospital care, a BBC investigation has found.

Health Minister Anna Soubry admitted the system for identifying people who are not entitled to free care is complex and at times "flawed".

Hospitals in England and Wales are obliged to ensure NHS patients have lived in the UK for the past 12 months.

It seems very strange...to open the door...to the citizens of the world to walk in and have free medical care Dr Chris Clayton-Payne, GP

But 45 out of 133 hospital trusts which gave details said they do not check.

In responding to Freedom of Information requests from the BBC's Panorama programme, those hospitals that had identified overseas visitors who had received treatment on the NHS had written off more than £40m in losses.

That is a figure that one MP described as "the tip of the iceberg" of overall costs of treating visitors who should not be given free access to the health care system.

Black market

A six-month long investigation by the BBC also uncovered a thriving black market in medical referrals and treatment in which access to GPs and hospital care was being fraudulently bought and sold.

In Birmingham, a practice manager was secretly filmed selling places at a doctor's surgery for as much as £800 per patient.

An undercover reporter, posing as a health tourist, paid £800 to register at the practice and was then able to obtain an MRI scan for free at a local hospital.

Following today's reports on BBC News, the practice manager has been removed from their duties by the Primary Care Trust.

In two other instances, after middlemen were paid to arrange GP access, London-area hospitals performed both X-rays and blood tests for other undercover reporters using fake identities.

Jim Gee, the former head of NHS Protect, the body charged with combating fraud within the health service, called the the system in hospitals "unworkable".

The grey area hinges on the term "ordinarily resident" which is the threshold by which people are entitled to free NHS care.

"Ordinarily resident is a phrase which sounds good common sense, but when it comes down to actually implementing it the policy is often unworkable," Mr Gee said.

Pamela Ward, a retired NHS overseas manager, said in many cases hospitals assume that patients referred by NHS GP surgeries qualify for free care.

"They have an English address, a registered GP, an NHS number - so there is really no way that the hospital will pick up from that," she said of the lack of checks.

'Offensive'

The Freedom of Information requests sent to all 171 hospital trusts in England and Wales - of which 133 responded - found that one third were not asking patients whether or not they were resident in the UK and therefore eligible for treatment.

The FOI results showed that hospitals had written off at least £40m worth of care given to health tourists over a four year period, a figure that Conservative MP Chris Skidmore said did not reveal the extent of the cost to the NHS.

Panorama: Find out more Declan Lawn presents Panorama: Britain's Secret Health Tourists

BBC One, Wednesday, 3 October at 21:00 BST Then available in the UK on the BBC iPlayer

"When you look at some of the trusts who have come back and have said 'We have no bills whatsoever that are owed to us,' that is clearly not the case - they've clearly not been collecting the data."

Health Minister Ms Soubry said she disagreed with current policy that requires hospitals to even pose the question of patients, saying it is not what patients should face when they arrive at a hospital.

"There are many people…myself among them, who would be offended frankly if every time I went to hospital I was effectively being asked to prove that I was entitled to free NHS treatment. I don't think anybody wants that system."

She agreed that the guidance, as it stands, is complex and said the system has failures and is flawed. The minister said an ongoing government review of how to determine NHS eligibility aims to address the shortcomings.

Recent Department of Health guidance issued to primary care trusts states: "Overseas visitors, whether lawfully in the UK or not, are eligible to register with a GP practice."

It said that GPs should not turn patients down, even if they fail to provide identification or proof of address.

Dr Chris Clayton-Payne, a GP from Saffron Walden, said of the new guidance: "It seems very strange when we're shaving off the pennies here and there to actually open the door wide to the citizens of the world to walk in and have free medical care at primary care level in the UK."

Panorama: Britain's Secret Health Tourists, BBC One, Wednesday, 3 October at 21:00 BST and then available in the UK on theBBC iPlayer.