(CNN) -- A roundup of reactions to President Barack Obama's unannounced visit to Afghanistan, where he and Afghan President Hamid Karzai signed an agreement on future ties:
"We are here to visit military personnel in Afghanistan, and we found out this afternoon the president would be coming in. And we were fortunate enough to be invited to witness the signing of the long-term relationship agreement."
-- Sen. Jack Reed, D-Rhode Island, who was on a visit to Kabul when Obama arrived
"I think it's a good thing. I think it's always good when the president goes to where young men and women are in harm's way, and I think that many of us who have been involved in Afghanistan are very supportive of the strategic partnership agreement, which I'm sure he'll be talking about. We think the agreement is good."
-- Arizona Sen. John McCain, the ranking Republican on the Senate Armed Services Committee and Obama's onetime presidential rival
"There's nothing new in the agreement. It just basically says we're going to have an ongoing relationship; we're not going to have any permanent bases. We'll work together as partners, and the troops -- fighting troops -- will be out in 2014. It says what we've already been doing."
-- Rep. Howard "Buck" McKeon, R-California, chairman of the House Armed Services Committee
"Tonight's agreement will help bring about an Afghanistan that is more secure from al Qaeda's return and from Taliban domination. That is a real achievement for both our countries, for the region and for the world. It was an especially powerful moment to witness what I believe will be a big step toward ending a long war that has demanded so much sacrifice from the men and women who serve our nation and their families."
-- Sen. Carl Levin, D-Michigan, chairman of the Senate Armed Services Committee, who had gone to Kabul with Reed on a previously scheduled trip
"Clearly, this trip is campaign-related. We've seen recently that President Obama has visited college campuses in an attempt to win back the support of that age group since he has lost it over the last three years. Similarly, this trip to Afghanistan is an attempt to shore up his national security credentials, because he has spent the past three years gutting our military."
-- Sen. James Inhofe, R-Oklahoma, in a prepared statement
"With the signing of the Strategic Partnership Agreement, we have reached a turning point in the Afghan war. With proper implementation, this agreement will be the end of the Taliban's dream of retaking Afghanistan. The SPA shows a commitment to the development and security of Afghanistan over the next decade, an event which is in our own national security interests."
-- Sen. Lindsey Graham, R-South Carolina, another Armed Services member
"I applaud him being in Afghanistan. I think it's important for the troops to see the president. And certainly after all of these years of fighting where the troops have done such heroic work and did such an outstanding job, I think it's important for the president to be there and signing the agreement with President Karzai."
-- Rep. Peter King, R-New York, chairman of the House Homeland Security Committee