In a lively give-and-take with students at the Government College of Lahore, Clinton said inaction by the government would have amounted to ceding ground to terrorists.
"If you want to see your territory shrink, that's your choice," she said, adding that she believed it would be a bad choice.
Clinton met with the students on the second day of a three-day visit to Pakistan, her first as secretary of state.
Shortly after she arrived in Islamabad on Wednesday, a car bomb exploded in a market crowded with women and children in Peshawar, killing 105. It was the deadliest attack in Pakistan since 2007.
Clinton's visit is designed to get maximum public exposure to improve America's image in a country where many people dislike and distrust the United States.
As a way of repudiating past U.S. policies toward Pakistan, Clinton told the students "there is a huge difference" between the Obama administration's approach and that of former President George W. Bush. "I spent my entire eight years in the Senate opposing him," she said to a burst of applause from the audience of several hundred students. "So, to me, it's like daylight and dark."
Clinton likened Pakistan's situation — with Taliban forces taking over substantial swaths of land in the Swat valley and in areas along the Afghan border — to a theoretical advance of terrorists into the United States from across the Canadian border.
It would be unthinkable, she said, for the U.S. government to decide, "Let them have Washington (state)" first, then Montana, then the sparsely populated Dakotas, because those states are far from the major centers of population and power on the East Coast.
Clinton was responding to a student who suggested that Washington was forcing Pakistan to use military force on its own territory. It was one of several questions from the students that raised doubts about the relationship between the United States and Pakistan.
During her hour-long appearance at the college, Clinton stressed that a key purpose of her three-day visit to Pakistan, which began Wednesday, was to reach out to ordinary Pakistanis and urge a better effort to bridge differences and improve mutual understanding.
"We are now at a point where we can chart a different course," she said, referring to past differences over an absence of democracy in Pakistan and Pakistani association with the Taliban in Afghanistan.
Although Clinton said she was making a priority of engaging frankly and openly on her visit, she declined to talk about a subject that has stirred some of the strongest feelings of anti-Americanism here — U.S. drone aircraft attacks against extremist targets on the Pakistan side of the Afghan border.
The Obama administration routinely refuses to acknowledge publicly that the attacks are taking place.
"There is a war going on," she said, and the U.S. wants to help Pakistan be successful.
The drone attacks have killed a number of Pakistani civilians, while also reportedly succeeding in eliminating some high-level Taliban and other extremist group leaders.
Before flying to Lahore from Islamabad, Clinton visited the Bari Imam shrine, named after Shah Abdul Latif Kazmi, a 17th century Sufi saint who died in 1705 and later came to be known as the patron saint of Islamabad. A suicide bomber struck the shrine in May 2005, killing a number of people.