Junior doctors are in rebellion against a new contract to be imposed on them from next August. The signs are that many will walk away from the NHS and take less stressful and more lucrative work abroad. These are among the brightest and best of their generation, who competed fiercely for precious medical school places – and they are now at risk of being lost, not just to the NHS but to the country.

Their new contract will stop paying them extra money for antisocial hours, so they can work up until 10pm all week and all of Saturday until late, for no extra money. After five years of the most intensive study, exams and work, their starting salary is £23,000: not a fortune compared with where many of those of equivalent education would be at the same age in other occupations. Typically, their pay now might be enhanced to £31,000 with overtime – but that’s what many will lose, often a pay cut of 30%.

What an odd time to take on the doctors, as the NHS is under greater pressure than ever before, the 1% pay rise following years of freezes that are already causing deep grievance. There is a serious shortage in the proportion of doctors willing to go into acute medicine (48%), renal (48%), (obstetrics 25%) and many other specialisms.

The government promises another 5,000 GPs, but where are they to come from, when too few go into it and many more retire early from exhaustion? There are 600 unfilled GP vacancies, and that number is rising. Now the new contract will take away the supplement for GP trainees, designed to give them parity with those in hospital medicine – hardly an inducement.

The shortages put more pressure on existing doctors covering for the missing staff, many doing long extra hours to fill gaps in rotas. Last year the NHS spent £3.3bn on agency staff to plug staffing gaps. Jeremy Hunt has ordered them to stop – but it’s unclear how. Dr Cliff Mann, A&E consultant in Taunton and president of the Royal College of Emergency Medicine, has long warned of the burnout rate, with unfilled vacancies and an exodus abroad making the pressures intolerable.

The General Medical Council reports unprecedented numbers of junior doctors applying for certification to work aboard. Recently the Guardian reported on just one agency – Austmedics – attracting an ever greater flow of doctors to Australia, with 30-40 enquiries a month. No wonder, since they had plentiful jobs on offer where, for example, a consultant radiologist can earn £250,000 in Perth working civilized hours without pressure, and buy a five-bed house with a pool for £500,000. GPs can earn double, and pay 12 times less medical insurance, with sane working hours. Here, they must cope with a tidal wave of extra elderly patients, on a shrinking share of NHS funding. Flight to New Zealand, Canada and elsewhere is also accelerating.

It can cost up to £1m to train a British doctor, so what on earth are we doing skimping on their pay and conditions, putting unbearable pressure on them and making a social or family life virtually impossible? At the same time we are scrambling to import more doctors from abroad, who often need English teaching and extra training and exams before they can practice, often denuding needier countries of precious medical skills in the process.

I see a compromise here – though junior doctors may resist. Why not pay them fairly, train and employ many more so they are not endlessly filling gaps and overworking – but oblige them, in exchange for their expensive training, to work for the NHS for, say, a decade.

If they were indentured to the NHS, along with dentists, nurses and the other medical professions, their tuition fees would have to be reduced or waived to take that into account, and they would need to be guaranteed fair pay. There is something perverse about selecting the very best students, in the toughest competition, and spending so much to train them to the highest standard, only to let them vanish abroad with all that value added to them. Somewhere here, there is a fair deal to be struck.