Kerry, who rushed to Pakistan to try to prevent a diplomatic meltdown over the continued detention of American Raymond Davis, sounded upbeat at the end of two days of meetings with senior Pakistani government officials and opposition powerbrokers.
The U.S. says Davis shot two Pakistanis in self-defense as they tried to rob him Jan. 27, and that his detention is illegal under international agreements covering diplomats. Pakistani leaders, fearful of stoking more outrage in a public already rife with anti-U.S. sentiment, have said the matter is up to the courts to decide.
Davis' next court hearing is set for Thursday.
"I look forward in the next few days, hopefully, to finding the ways that we all agreed on - that we can find - in order to resolve this issue," Kerry told reporters before boarding a plane in the Pakistani capital.
The dispute has become a bitter point of contention between the United States and Pakistan - a key ally in the war in Afghanistan. The U.S. senator said his meetings were encouraging, and stressed that all involved said they wanted and expected to end the standoff amicably.
"Now everybody has to work in goodwill to make the words mean something," Kerry said. "They will only mean something with actions that result in an appropriate and judicious outcome being accomplished. I think that will be done."
But Kerry's upbeat attitude contrasted with a sense of internal divisions within Pakistan's government over how to handle the case.
Pakistan's former foreign minister maintained Wednesday that legal advisers told him Davis did not qualify for "blanket" diplomatic immunity, without elaborating. This came after a government official told The Associated Press on Tuesday that the government would tell the court that most of its legal experts had decided that Davis is immune from prosecution.
Shah Mahmood Qureshi, who stepped down earlier this month during a Cabinet shake-up but retains influence, reiterated this stance after meeting with Kerry - an indication that the American politician may have a rocky time convincing Pakistan to free the 36-year-old Davis.
The Pakistani government is also under intense public pressure; crowds of protesters have urged the government in recent weeks to try Davis.
In the southern city of Karachi on Wednesday, dozens of young men protested U.S. efforts to win Davis' release. About 50 members of an Islamist political party gathered outside the Karachi press club chanting "Down with America!" They also torched effigies of Obama and Kerry.
Upon arriving in Pakistan late Tuesday, Kerry, a Democrat from Massachusetts, reached out to Pakistan's government and people. He expressed regret over the loss of lives and promised that the U.S. will conduct a criminal investigation into the shooting if Davis is released.
On Wednesday, Kerry also met with President Asif Ali Zardari, army chief Gen. Ashfaq Parvez Kayani and Prime Minister Yousuf Raza Gilani.
Gilani's office issued a statement saying the prime minister had raised the possibility of another solution to the spat: having the U.S. compensate the families of the dead in lieu of sending Davis to prison.
Such a system is used in Islamic law and accepted in Pakistan. At least some of the dead men's relatives have already rejected the idea, however.
Gilani and Kerry agreed to use "diplomatic channels" to help resolve the issue legally and to avoid inflammatory statements in the media, the statement said.
President Barack Obama has insisted Davis be freed, saying the principle of diplomatic immunity must be upheld.
Part of the confusion over Davis' status lies in his background.
The administration insists Davis was part of the embassy's "administrative and technical staff," which means he might have been involved with security, but Pakistani media have focused on him being a former Special Forces soldier who runs an American "protective services" company with his wife.
Although the U.S. says he's an embassy employee, he apparently had been attached for a while to the consulate in Lahore, further adding to the confusion about his status since consulate employees do not always get the same level of diplomatic protection as embassy staffers.
The AP also obtained a photocopy of an ID and a salary document that Davis apparently gave Pakistani authorities, showing that he was scheduled to be paid $200,000 from Sept. 21, 2010, until Sept. 20, 2011, for "overseas protective sec. svcs.," training, administration work and insurance and travel expenses.
Davis is identified as a Defense Department contractor on the ID card.
Associated Press writers Zarar Khan in Islamabad and Ashraf Khan in Karachi contributed to this report.