John Kerry arrives in Kabul seeking to repair ties with Afghan leader Hamid Karzai Jason Reed / AP Secretary of State John Kerry, accompanied by U.S. Ambassador to Afghanistan James Cunningham, left, meets with Afghan President Hamid Karzai at the Presidential Palace in Kabul, Monday. By Andrea Mitchell and Jamieson Lesko, NBC News KABUL -- Secretary of State John Kerry arrived in Afghanistan's capital Monday on an unannounced visit that aims to repair fractured ties with President Hamid Karzai. It is Kerry's sixth visit to Afghanistan since President Barack Obama took office, but his first as secretary of state. State Department officials told reporters traveling with Kerry that he is optimistic the U.S. and Afghanistan can overcome recent differences, including an awkward moment earlier this month when Karzai accused the U.S. and the Taliban of colluding to convince Afghans that foreign forces were needed beyond 2014. The officials said Kerry was not in Kabul to lecture or chide Karzai, adding that he acknowledged the relationship was "not always going to be easy." The secretary of state arrived in Kabul this morning just a day after another unannounced visit to Baghdad. Kerry plans to meet with Afghanistan's president Hamid Karzai to discuss political and security issues. Kerry is optimistic the two countries can move in from Karzai's anti-U.S. rhetoric, which the commander of U.S. forces in Afghanistan warned was putting the lives of Western troops in danger. Senior officials on Kerry's plane said the timing was good for the meeting, since the U.S on Monday handed over control of the prison at the Bagram base to Afghan control, an issue of contention for Karzai. U.S. officials say they've been assured the most dangerous prisoners will not be released. Kerry is expected to travel to the U.S. Embassy compound before heading to meet Karzai at his palace. Anja Niedringhaus / AP An Afghan prisoner leaves with his belongings from the Parwan Detention Facility outside Kabul after the U.S. military gave control to Afghan authorities, Monday. On Sunday, Kerry visited Iraq before leaving for dinner in the Jordanian capital, Amman, with Pakistan's powerful army chief of staff, Ashfaq Kayani. The secretary of state is not visiting Pakistan during this trip as the country is in the midst of a political transition. Kerry urges Iraq to stop arms flow to Syria on Baghdad visit This story was originally published on Mon Mar 25, 2013 8:03 AM EDT