IN PLOIESTI, just north of Bucharest, Daniela Margaritescu had a grand house, a big car and her own surgery. But when she set eyes on the Beechfield Medical Centre in Spalding, Lincolnshire, it was “love at first sight”. The 46-year-old Romanian was hired last year as part of a pilot scheme to recruit more foreign doctors to fill chronic vacancies in primary care. For Dr Margaritescu it is a “perfect” deal. She learns new skills, her three children attend good schools and her pay has roughly doubled. For their part, the people of Lincolnshire—who voted heavily to leave the European Union in the referendum of 2016—are happy to have new doctors at last.

As people return spluttering from their Christmas holidays, the National Health Service is entering its busiest time of the year. On January 3rd Jeremy Hunt, the health secretary, apologised to patients after non-essential operations were suspended until the end of the month to ease the pressure on hospitals. Senior doctors took to Twitter to lament the “third-world” conditions on wards. But although the scenes in hospitals, where patients have been left waiting on trolleys in corridors for hours, are dramatic, a less-noticed crisis is under way on the front lines of the NHS. General practitioners (GPs), patients’ first port of call and the gatekeepers of most health services, are a dwindling army.

Take Lincolnshire. Before the arrival of Dr Margaritescu and 24 other doctors from eastern Europe, 104 of the county’s 434 potential spots for GPs were vacant. The Beechfield practice ran three recruitment rounds without finding a suitable candidate. “People drive past [Lincolnshire] on the way to Scotland, and then again on the way back to London,” says Kieran Sharrock, medical director of the local body that represents GPs. There is no medical school in the county, depriving it of a pipeline of talent. Doctors balk at joining remote practices with lots of old patients; in some Lincolnshire surgeries, half the patients have at least four chronic diseases.

Lincolnshire’s woes are particularly severe, but across the board the NHS is struggling to hire and retain GPs. It recently changed how it counts them, so deciphering trends is tricky, but the number of GPs has probably been falling since at least 2009, during which time the number of hospital consultants has risen by a third. In 2016 Simon Stevens, the chief executive of NHS England, pledged to recruit 5,000 more GPs over the next five years. But the count has fallen further, reaching the equivalent of 33,302 full-time GPs in September, 1,290 fewer than two years earlier. The number of surgeries has dropped to 7,674, from 8,451 a decade ago. Some towns face losing most of theirs; last year seven of the eight practices in Folkestone, on the south coast, said they intended to close.

Even before the creation of the NHS in 1948, family doctors played an outsized role in providing health care in England. Their pivotal position was described in the novels of Anthony Trollope and George Eliot. Today Mr Stevens calls the GP arguably the most important job in Britain. They decide when to refer patients for hospital care, and provide a wider range of services than their peers in many countries (Polish doctors in Lincolnshire note that back home they rarely saw children or dealt with gynaecological cases). And their role is set to become even more important: the government wants more patients with chronic conditions to be cared for outside hospital, which will require GPs to co-ordinate treatment.

What seems to be the problem?

The shortage of GPs partly reflects a change in the workforce. In 2006, 43% of GPs were women; a decade later the share was 55%. It is set to rise further, since male GPs are closer to retirement age, on average. Because only one-fifth of female GPs work full-time, compared with half of male GPs, more of them are needed. A recent analysis by Imperial College London suggests that an additional 12,000 GPs will be required by 2020—more than twice the NHS’s target.

Another reason is that the job has become less attractive. GPs complain of having to do more work for less pay—and they have a point. The English population has grown by 4.3m in the past decade, and patients are seeking help more often than they used to. The number of consultations per patient increased by about 10% between 2007 and 2014, according to a study in the Lancet, a medical journal. A survey of GPs in 11 countries by the Commonwealth Fund, a think-tank, found that 92% of British GPs reported typically spending less than 15 minutes with a patient, compared with 27% of GPs in other countries. British GPs were also the most likely to say they were stressed.

One London-based GP describes a “light day”: 25-30 scheduled appointments; five to ten emergency ones; one or two home visits; 30-50 replies to be written to hospital doctors, plus a similar pile of pathology reports to read; and 10-20 repeat prescriptions to process. Some feel like secretaries, writing referrals for ungrateful patients. It is a lonely job, without the camaraderie of a hospital ward.

Over the past decade GPs’ pay has fallen. In 2004 the Labour government agreed on a contract that raised the average pay of a partner in an English surgery to £136,665 ($185,000) in today’s prices. Since then partners’ pay has slipped to £104,900, as successive governments have made the contract less generous. Salaried GPs earn an average of £63,000, less than hospital doctors with similar experience. And, unlike those clinicians, GPs pay thousands of pounds a year in indemnity insurance.

In an ordinary labour market, employers could raise pay to fill vacancies. But the NHS, the world’s fifth-largest employer (behind the American and Chinese armed forces, Walmart and McDonald’s) does not operate in an ordinary labour market. In effect, pay is set at a national level. The number of doctors to be trained in each specialism is determined centrally years in advance. Since it typically takes ten years to train a GP, failures of planning mean shortages that take a decade or more to fix.

The government has said it will increase the number of places at medical schools by 25% from September. (Unlike other degrees, there is a cap on places to study medicine, because the course is heavily subsidised.) But that will take time to translate into more GPs. It will also require universities to improve the reputation of general practice; for a certain type of thrusting medical student, only dentists are viewed with more disdain than would-be GPs.

With no end to the staffing problem in sight, some surgeries are adapting. They are employing more paramedics, nurses and pharmacists to see patients. Several surgeries are becoming mega-practices, spreading the GPs they have across many sites. Others will increasingly rely on doctors from overseas. Britain already employs a higher share of foreign doctors (27%) than the average across the 28 members of the OECD club (17%). Of the 12,771 doctors who registered in Britain in 2016, 44% had qualified overseas.

According to research by Aneez Esmail of the University of Manchester, and colleagues, foreign-trained GPs are more likely than British ones to work in poor areas, earn less money and work longer shifts. But doctors trained abroad also score lower on postgraduate medical exams, and are more often subject to complaints. In Lincolnshire the doctors recognise they have a lot to learn. Accordingly, for their first two years they get twice as much time to spend with patients as other GPs do.

Those running the pilot believe that it will continue after Britain leaves the EU, given the need for GPs. The NHS has said it wants the programme to be scaled up to attract 2,000 foreign GPs. Tomasz Grela, a genial new Polish doctor in Spalding, is not too worried about Brexit. “The medical system needs us,” he says. And although he readily concedes that he needs to get up to speed with the British system, he is showing signs of acclimatisation. Asked what frustrates him most about the NHS, he gives the same response as most British doctors: “Bureaucracy.”