David Cameron has said the public "want an endgame" to the war in Afghanistan as he prepares to hold talks with Barack Obama about the conflict.

The leaders are expected to agree that Afghan forces should take over a lead combat role by mid-2013 - earlier than planned - but the US President has said there will be no "rush for the exits".

Mr Cameron said the country "won't be a perfect democracy" by then, but people want troops to come home.

He is in the US for a three-day visit.

Mr Cameron made his first official visit to the US as prime minister in July 2010. The latest meeting comes ahead of Nato and G8 summits.

'Very long time'

Afghanistan is expected to dominate discussions between the PM and President Obama, although other topics including Syria and Iran are also likely to be on the agenda.

The visit comes at a tense time for Afghanistan after an American soldier shot dead 16 Afghan civilians. As an Afghan government delegation visited the site in Kandahar on Tuesday, they came under attack from militants.

Speaking as he arrived in Washington, Mr Cameron told journalists: "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.

"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.

"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."

But he added: "I accept it won't be a perfect democracy. There will be huge development problems."

British and US combat troops are expected to leave Afghanistan by the end of 2014.

Basketball game

Downing Street would not confirm a detailed timetable for the handover of combat duties to Afghan troops, but the BBC understands an agreement will be made to hand over the lead combat role the previous year.

Mr Cameron and his wife Samantha were greeted at Andrews Air Force Base, near Washington, by a guard of honour and a military band.

The prime minister later met the president at the White House before the two men travelled to Ohio - a crucial swing state in this year's presidential election - to watch a university basketball game.

They made the trip on Air Force One, with Mr Cameron becoming the first foreign leader to be welcomed onto the presidential plane by President Obama.

And the atmosphere was relaxed as the leaders, wearing casual clothes, were applauded when taking their seats at the University of Dayton Arena and chatted to student spectators around them.

Mr Cameron tucked into a hotdog as basketball fanatic Mr Obama apparently pointed out aspects of play, with the Mississippi Valley State Delta Devils defeating the Western Kentucky Hilltoppers 23-19.

Ahead of his arrival, the prime minister had said the so-called "special relationship" between the US and UK was "increasingly strong, based on common interests and common values".

'Deeply rational'

"I'm very glad I do get on so well with Barack Obama," he said. "We shouldn't have to take its temperature all the time.

"Sometimes we can over-analyse how many phone calls and how many meetings, but I don't look at it like that.

"Obama's approach is deeply rational and reasonable, and also very strong."

Meanwhile, Mrs Cameron joined First Lady Michelle Obama on an engagement at Washington's American University, where they will meet children who have been taking part in a mini-Olympics event.

They also spent time with pupils from Elizabeth Garrett school in north London, who first met Mrs Obama during her trip to the UK in 2009 and have been invited over by her for a return visit.

During the event, Mrs Obama announced that she will lead the presidential delegation to the opening ceremonies of the 2012 Olympic Games in London.