British Prime Minister David Cameron has accepted that Afghanistan will not be "a perfect democracy" by the time British troops exit the country, but said that the British public wants to see an "endgame" to a military operation that has lasted more than a decade.

Mr Cameron was speaking on board his chartered plane as he headed to the United States for talks with President Barack Obama in which the two leaders are expected to sketch out a timetable for the withdrawal of international troops from Afghanistan by the end of 2014.

No announcement of further troop withdrawals is expected during his three-day visit, but the two leaders will seek to identify a date - possibly as early as mid-2013 - for Afghan forces to take over the lead security role throughout the country.

The transition date is expected to be formally agreed and announced at NATO's summit in Chicago in May, and will allow British and US troops to move into a support role and pave the way for the return home of large numbers in a gradual process beginning next year.

Mr Cameron and Mr Obama used a joint article in the Washington Post today to say they were "proud of the progress our troops have made in dismantling al-Qaeda, breaking the Taliban's momentum and training Afghan forces".

In the wake of the recent deaths of six British soldiers and the massacre of 16 Afghan civilians by a renegade US serviceman, they acknowledged that NATO-led operations in Afghanistan remain "a difficult mission".

But both men indicated they would not be knocked off course or pushed into a precipitate exit from Afghanistan, saying: "We honour the profound sacrifices of our forces and in their name we'll carry on the mission."

Mr Cameron made clear that his view of what constitutes a successful completion to Britain's mission is less ambitious than the dream of a modern democracy in the heart of central Asia bandied around in some quarters when the Taliban regime was first toppled in 2001.

"What I define as doing the job is leaving Afghanistan looking after its own security, not being a haven for terror, without the involvement of foreign troops," he told reporters.

"That should be our goal. So that the British public, our troops and the Afghan government frankly, know there's an end to this.

"This is what we defined in 2010 through the National Security Council. I accept it won't be a perfect democracy. There will be huge development problems."

In recognition of growing public weariness with the war, which a large majority of voters in a recent poll said was unwinnable, Mr Cameron added: "I think people want an endgame. They want to know that our troops are going to come home, they have been there a very long time."

Mr Cameron said that he and Mr Obama will use this week's talks to ensure that the UK and US are "absolutely in lock-step" over the withdrawal process, as well as to discuss future support for Afghanistan after the International Security and Assistance Force has left.