Secretary of State John Kerry on Friday left the hospital where he has been recovering from a broken leg after a bicycling accident, and said he expects to join the Iran nuclear talks for their "last slog" at the end of June.

Kerry, who is 71, emerged from Massachusetts General Hospital in Boston shortly before 5 p.m., walking gingerly on two crutches. He wore what appeared to be white running shoes instead of his normal wingtips, and he looked pale after spending almost two weeks in the hospital. But he seemed in good humor as he joked that he was loves exercising and was looking forward to more physical therapy.

"I'm confident I'll be as good to go as I was before. If not stronger," he told reporters waiting for him at the hospital entrance.

Kerry's orthopedic surgeon, Dennis Burke, said the surgery to repair the secretary's broken right femur was uncomplicated, adding that with physical therapy, Kerry would be fully recovered "in several months."

Burke did not say what he thought of Kerry's pledge to ride his bike again, even though it was a fall from his bike in the Alps outside Geneva on May 31 that sidelined him.

Kerry said he would spend the weekend at his Boston residence with his wife, Teresa, and his dog, Ben, and expects to return to Washington next week. He said he will be in Washington for talks with Chinese officials scheduled for July 23 and 24, and "Afterwards, I will leave to go for the last slog on the Iran talks."

Kerry has been a critical figure in the talks with Iran, which face a June 30 deadline for a deal to rein in Iran's nuclear program in exchange for lifting sanctions. State Department officials had given assurances he would be able to join the talks when necessary, but some had feared his recovery process might prohibit him from participating in person, a prospect that threatened to doom the outcome.

But Kerry said his absence since his biking accident has had no impact on the talks, which are currently underway in Vienna involving teams of negotiators from Iran, the United States and five other world powers.

"I had no plans to be personally involved with my foreign minister counterparts until a week or two from now," he said, adding that he has no doubts he can join the talks and reach a deal by the deadline.

"I'm absolutely driving for the end of the month," he said.

An avid cyclist who often takes his bicycle on overseas trips, Kerry has been laid up since he fell off his bike at the start of a ride through the Alps after finishing a round of negotiations with Iranian Foreign Minister Mohammad Javad Zarif. He injured himself so badly that he canceled planned stops in Madrid and Paris, was hospitalized overnight in Switzerland and flew to Boston the next day on a military plane, accompanied by the physician who initially operated on his hip.

Kerry has maintained a fairly rigorous work schedule even in the hospital. One day, he was on the phone with U.S. diplomats in France at 4:30 a.m. to discuss a meeting in Paris on the Islamic State. His chief of staff, Jon Finer, has traveled to Boston at least twice to update him on hot spots around the world. And Kerry has talked regularly with Wendy Sherman, the undersecretary who is the lead negotiator in the Iran talks .