U.S. in Talks With Afghans on Presence After 2014 WASHINGTON - The United States and Afghanistan began talks on Thursday on a security agreement that would authorize an American troop presence in Afghanistan after 2014, when Afghan forces are to assume responsibility for the war. Gen. Joseph Dunford Jr., the Marine officer who has been nominated by President Obama to assume command of the military mission in Afghanistan next year, told Congress that the goal was to complete the talks by May 2013, well ahead of the deadline for handing responsibility to the Afghans. The timetable, he noted, is longer than the one the Obama administration set during its failed effort to negotiate a similar agreement with Iraq. "I think one of the critical lessons learned is that we need to allow sufficient time for negotiations to be complete," the general told the Senate Armed Services Committee on Thursday. The 2011 talks between the United States and Iraq ultimately failed over the American demand that a Status of Forces Agreement be approved by the Iraqi Parliament, a step the administration said was needed to provide legal immunity for American troops. But the limited time to sort out thorny political and legal issues was a complication: Mr. Obama formally opened the Iraq negotiations in June 2011, less than seven months before the deadline for American troops to leave the country if a new accord was not reached. The talks between the United States and Afghanistan are being led by James Warlick, the deputy special representative for Afghanistan and Pakistan, and Eklil Ahmad Hakimi, Afghanistan's ambassador in Washington. Assuming the necessary agreements can be reached, the United States and NATO are planning to keep a modest force in Afghanistan after 2014 to guard against terrorist threats and advise Afghan forces. A successful negotiation, General Dunford said, would send a message to the Afghans and to their neighbors that the United States was not abandoning Afghanistan. "Pakistan hedges its bets based on what they believe our long-term commitment to the region would be," he said. But even lawmakers who back the Afghan mission, like Senator Lindsey Graham, Republican of South Carolina, have said they would not support continued deployment unless the accord gives American troops immunity from prosecution in Afghan courts. If confirmed, which is considered very likely, General Dunford would take command from Gen. John R. Allen, who is scheduled to stay in charge until the change of command in February. General Allen's nomination to serve as the NATO commander after he leaves Afghanistan was delayed this week when the Defense Department began an investigation into e-mails he had sent to a woman whose complaint set off the scandal about David H. Petraeus's extramarital affair. It will be General Allen who will provide the White House with recommendations about how quickly the current 68,000-strong American force should be reduced, and he will provide much of the input on how large a post-2014 American and NATO force should be and how it might operate. But General Dunford said he would monitor the situation after assuming his post and advise if changes are needed. Asked if NATO was winning the war, General Dunford said, "Our goals are within reach."