The Afghanistan endgame looms as Kabul takes over security fully from the coalition of international troops in the country. On the same day, reports emerged detailing plans of talks in Qatar between U.S. officials and the Taliban.

Yuri Kozyrev / Noor for TIME Members of Afghan special forces during a training exercise on the outskirts of Kabul, May 2013.

Updated.

At 18, Habibi is the youngest and loudest of the new female recruits to the Afghan military’s special forces unit. She wears a black baseball cap instead of a head scarf, a pair of permanent wraparound shades, and carries her sub-five-foot frame with a practiced swagger. During her first few months on the job, Habibi has been living and working with American soldiers who have been teaching her first aid, radio communication, and how to search houses. She’s been teaching them how to lose. “We challenge them to shooting competitions,” Habibi said one afternoon in early May, leaning over to shovel some lunch in at a noisy mess hall in Kabul. Did she win? “Of course,” she says.

Afghan security forces are going to need all of Habibi’s bravado and more in the coming months. In a ceremony in Kabul on Tuesday, Afghan President Hamid Karzai announced that Afghan forces are officially taking full security responsibilities over from the international coalition, putting domestic military and police in control of the entire country for the first time since the 2001 U.S.-led invasion. The transition, which has been underway for two years, has already put the training, resources and dedication of the 350,000-strong Afghan National Army (ANA) to the test as Western troops have been receding into a supporting role ahead of their official withdrawal in 2014. “Challenges lie ahead,” International Security Assistance Force (ISAF) General Joseph Dunford said in a statement. “But today’s announcement recognizes the ability of a sovereign Afghanistan to meet those challenges.”

(PHOTOS: America’s Long Withdrawal from Afghanistan)

Hours before the ceremony, the reality of those words was on stark display as insurgents staged their fourth attack in Kabul in a month of intensifying violence. Three civilians were killed and over twenty wounded as a suicide car bomb, reportedly targeting an Afghan politician, went off near the Afghan Independent Human Rights Commission in the western part of the capital. Just last week, militants stage the deadliest attack in Kabul since 2011 near the nation’s Supreme Court, killing 17.

Later in the day, the Taliban announced that it is prepared to start the process of peace talks with the Afghan government, a move that was greeted with cautious optimism. U.S. officials told reporters that Washington would hold formal talks with the group in the coming days in Doha, where the Taliban plans to open a political office. A meeting between the Taliban and Afghanistan’s High Peace Council would, theoretically, follow, but whether the much-anticipated peace talks will go through is far from clear. Among other things, the Taliban has repeatedly refused to meet with members of Karzai’s government, and Karzai’s insistence that the talks be Afghan-led is seen by some as unrealistic for a dialogue in which the Taliban, Afghanistan, Pakistan and the U.S. all need to be involved to achieve lasting peace. Still, Washington took it as an encouraging sign that the Taliban says it wants to negotiate a peaceful end to the 12-year war and does not want threats to other countries to come from Afghan soil.

The Afghan National Army (ANA) was already leading security operations in 90% of the country before the security handover today. Though the capital has been under Afghan control since 2008, the broader transition of different parts of the country from ISAF to Afghan control has been underway since 2011. The last districts handed over today include several troubled areas in Kandahar and areas along the Pakistan border that are insurgent strongholds. The some 100,000 Western troops that remain in the country, including 66,000 Americans, will continue to support the ANA and Afghan National Police (ANP) with logistics, equipment, and training, but will no longer be at the ready in lifesaving roles like medical evacuation and air support except in rare cases.

(MORE: Talking with the Taliban)

Col. Jalaluddin Yaftaly, the commander of Habibi’s unit, expects that after 2014, the joint special forces will also be “working independently” of foreign troops. How his men and women and the rest of the Afghan National Security Forces (ANSF) will cope with a deteriorating security environment is a matter of much concern. Parts of the country that were safe not long ago — including Bamiyan, a formerly peaceful region that was the first area to go back to Afghan control in 2011 — are once again under threat. Some worry that parts of the south are as good as lost to the Taliban, and attacks are expected to ramp up further ahead of national elections and the exit of international combat troops next year.

NATO leaders insist that the hundreds of the thousands of Afghan security forces they have been training over the past decade are ready for the tough job. “We went to Afghanistan to protect our security by helping Afghans take control of their own security,” NATO Secretary General Anders Fogh Rasmussen said in a recent speech. “Afghan forces are getting stronger. And they are getting ready for more.” Yaftaly echoes that confidence, and adds that ordinary Afghans are in fact safer since his men and women took over operations in which soldiers drop in the middle of the night and surround the houses of suspected militants. “Afghanistan has had war for 30 years. Every household has a gun,” Yaftaly says. “When foreigners were entering and seeing that, they believed people were the enemies.” Though he says does not know what civilian casualty numbers were like when Western troops were leading the operations, Yaftaly he says he is certain civilian deaths have dropped dramatically since his soldiers took over. “Last year we conducted 800 or 900 operations and not one civilian was killed,” he says.



Yuri Kozyrev / NOOR for TIME Habibi and her fellow special forces recruits at a mess hall on a training base outside Kabul. Afghanistan’s military employs women to help in night raids against insurgents.

What dangers lie ahead for soldiers like Habibi is a different question. There were 1200 ANA fatalities and 2200 ANP fatalities in 2012, compared to 310 U.S. troop deaths, according to the Brookings Institution. Casualties in the Afghan army have been especially high this summer in the run-up to the handover, and desertion has become so common that officials told the New York Times last winter that the ANA was replacing a full third of its ranks every year. Without the backup of NATO medical evacuation teams and air support on most missions, the sticky situations that ANSF will continue to find itself in are going to get a lot stickier.

Habibi may be good with a gun — indeed, her supervising officer said that, much to his surprise, some of the female recruits were better shots than their male counterparts – but will good training and conviction be enough to protect her and tens of thousands of other soldiers if things get steadily worse? In May, at a training camp on the outskirts of Kabul, TIME asked Habibi and her colleagues what provinces their families were from. Habibi observed the process, holding her gun to her chest, and then got a last word in. “The important thing,” she said, “is that we’re all from Afghanistan.” Her bravado and patriotism may not be enough, but it’s a start.

MORE: Afghan Endgame