The British Government's strategy in Afghanistan was thrown into crisis last night after the Defence Secretary's right-hand man resigned in protest about the handling of the war.

Eric Joyce, a former major in the Black Watch, announced that he was standing down as the parliamentary private secretary to Bob Ainsworth. He attacked the treatment of UK forces and protested that Nato allies were doing "far too little", leaving British troops to shoulder more of the strain of combat.

Mr Joyce, who had been regarded as an ultra-loyalist Labour MP, said he could no longer justify the growing death toll in Afghanistan by arguing that the war would prevent terrorism in Britain.

Download the new Independent Premium app Sharing the full story, not just the headlines

He called on the Prime Minister to make clear that the UK's deployment in Afghanistan, where there are 9,100 troops, was "time-limited". His criticism – which follows protests from military commanders over the lack of support for British forces in Afghanistan – carries extra weight given his army background and his role as Mr Ainsworth's parliamentary aide. Mr Joyce quit as two more British soldiers were killed in Afghanistan, bringing the number of UK deaths to 212. Forty-one British troops died in July and August alone, and polls have shown a slump in public support for involvement in Afghanistan.

The timing of the resignation is particularly damaging to Mr Brown, who in a speech today was due to argue that the case for military action is as compelling as ever because three-quarters of terrorist attacks are orchestrated from the border areas of Afghanistan and Pakistan.

But in a scathing letter to the Prime Minister last night, Mr Joyce directly contradicted him. He wrote: "I do not think the public will accept for much longer that our losses can be justified by simply referring to the risk of greater terrorism on our streets.

"Nor do I think we can continue with the present level of uncertainty about the future of our deployment in Afghanistan."

Mr Joyce did not doubt Mr Brown's commitment to Britain's armed forces, but said that "there seem to me to be some problems which need fixing with the greatest urgency".

He said: "I think we must be much more direct about the reality that we do punch a long way above our weight, that many of our allies do far too little, and that leaving the field to the United States would mean the end of Nato as a meaningful proposition."

Ministers faced a "critical time for Labour and Defence". Mr Joyce stated: "It should be possible now to say that we will move off our present war-footing and reduce our forces there substantially during our next term in government."

Inside Politics newsletter The latest news on Brexit, politics and beyond direct to your inbox Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive updates on politics every morning by email Update newsletter preferences

The Falkirk MP protested over "behind-the-hand attacks by any Labour figure on senior service personnel" and called for members of the armed forces to be given "greater latitude to voice their views". He said: "Most important of all, we must make it clear to every serviceman and woman, their families and the British public that we give their wellbeing the highest political priority."

Mr Joyce also lashed out at the contribution from Nato allies in Afghanistan, and raised doubts over the recent Afghan elections. "We also need a greater geopolitical return from the United States for our efforts. For many, Britain fights; Germany pays; France calculates; Italy avoids," he wrote.

"I do not think the British people will support the physical risk to our servicemen and women unless they can be given confidence that Afghanistan's government has been properly elected and has a clear intent to deal with the corruption there, which has continued unabated in recent years."

His comments go to the heart of a series of dilemmas facing ministers over Afghanistan. They are aware of falling public support for the war, underlined by a ComRes survey six weeks ago for The Independent which found that 52 per cent of voters wanted troops to be withdrawn from Afghanistan straight away, while 58 per cent viewed the war as "unwinnable".

The Government also fears a long drawn-out commitment in Afghanistan – the head of the British Army has suggested it could take 40 years to stabilise the country – and is frustrated over the refusal of other Nato allies to deploy troops to the country.

After a torrid week dominated by accusations over the release of the Lockerbie bomber, Mr Brown had hoped to get back on the front foot today with his speech on Afghanistan, and by welcoming world leaders to London for a meeting of the G20.

But his hopes were wrecked last night by the announcement of Mr Joyce's resignation and the release of his letter. Mr Ainsworth made little secret of his irritation with his former aide in a statement last night.

He said: "Eric Joyce is, of course, entitled to his opinion and whilst we thank him for his service as a junior parliamentary aide, it is vital that we have a leadership team that is fully committed to our mission in Afghanistan. The picture he paints is not one that I nor many people within the Ministry of Defence recognise, whether military or civilian."

And in a curt letter last night Mr Brown told Mr Joyce: "Bob Ainsworth has already replied to you emphasising the importance of the effort in Afghanistan to defeating terrorism, and of supporting, at all times, our Armed Forces. I am determined that nothing will distract my Government from this most vital of tasks."

Mr Brown, who visited Afghanistan last week, will hit back at accusations that British troops in Afghanistan are under-funded. He will argue that £390,000 is spent on each soldier, up from £180,000 three years ago. He will also say that the timetable for training the Afghan army is being accelerated. Over 130,000 troops will be trained by the end of next year, 12 months earlier than planned, he will promise.

End of the affair: Why the former Major decided enough was enough

The first inkling that Labour ultra-loyalist Eric Joyce was losing patience came last month. When the Ministry of Defence mounted a legal challenge to reduce compensation payments made to two injured soldiers, he called its behaviour "bonkers" and said that success would be "a victory for bureaucracy over bravery".

His resignation yesterday will be especially embarrassing for the Prime Minister, as Joyce is one of very few Labour MPs with military experience. He joined the Army aged 18 in 1978, as a private in the Black Watch. In 1981 he took a sabbatical to attend university, gaining a BA in Religious Studies from Stirling University.

He then attended Sandhurst and was commissioned into the Royal Army Educational Corps as Captain. But after 12 years of distinguished service, including promotion to Major in 1992, his service was terminated after he described the Armed Forces as "racist, sexist and discriminatory". His commanding officer described him as "uncommandable by me or anyone else".

This was not a characteristic he brought with him to Westminster however, after he narrowly defeated the Scottish National Party candidate in the 2000 Falkirk West by-election. So extreme was his loyalty to the Labour cause, particularly after the Iraq invasion, that it often drew ridicule.

On Channel 4 News in 2004, Jon Snow asked him: "Is there anything that the Government has done with which you disagree?" Roy Hattersley referred to him as an "embarrassing sycophant" and suggested his loyalty might see him rise to "the giddy heights of parliamentary secretary", which indeed it did. He first became parliamentary private secretary to Mike O'Brien at the Department of Trade and Industry in 2004 and later served as an aide to Margaret Hodge and John Hutton in the same department. When Hutton moved to the Ministry of Defence, he moved with him and remained there when Bob Ainsworth took over in June this year.

As well as the Armed Forces, Joyce lists among his interests "poverty reduction", which caused some mirth when the expenses scandal shed light on his efforts to reduce his own.

In the 2005-06 parliamentary session, he claimed £174,811 in expenses, the highest of all MPs, and had the dubious distinction of becoming the first MP to claim cumulatively more than £1m. When one newspaper asked him what he would do if he were asked to repay any of the £40,000 of unpaid capital gains tax on the sale of his second home, he said he would "suck it and see".