WASHINGTON - House and Senate negotiators have decided to close a Pentagon office that was developing a vast computerized terrorism surveillance system and to bar spending that would allow those high-tech spying tools to be used against Americans on U.S. soil.

But they left open the possibility that some or all of the high-powered software tools under development might be used by different government offices to gather foreign intelligence from foreigners, U.S. citizens abroad or foreigners in the United States.

The controversial Terrorism Information Awareness program was conceived by retired Adm. John Poindexter and was run by the Information Awareness Office that he headed inside the Defense Advanced Research Projects Agency. It was developing software that could examine the computerized travel, credit, medical and other records of Americans and others around the world to search for telltale hints of a terrorist attack.

Sen. Ron Wyden, D-Ore., who has led a campaign against the program, hailed the result Wednesday. "Americans on American soil are not going to be targets of TIA surveillance that would have violated their privacy and civil liberties. The government is not going to be able to pick Americans up by their ankles and shake them to see if anything funny falls out," Wyden said in an interview.

"The original Poindexter program would have been the biggest surveillance program in the history of the United States," he added. "Now the lights have gone out on the program." He said the agreement would allow foreign intelligence gathering on terrorism "without cannibalizing the civil liberties of Americans."

Poindexter's office told contractors that he wanted the software to allow U.S. agents to rapidly scan and analyze multiple petabytes of information. Just one petabyte of computer data could fill the Library of Congress more than 50 times. Wyden said Senate negotiators working on the 2004 defense appropriations bill stood up to stiff resistance from their counterparts in the House, which had passed a weaker restriction. Wyden had drawn up the weaker restriction early this year before more details of the Pentagon effort became public. The House restriction allowed the research to continue at the Pentagon but barred its implementation against Americans in the United States without specific congressional approval. Later, the Senate passed a provision in next year's defense appropriation bill killing funding for the TIA program.

In addition to the data-scanning project, other TIA efforts that cannot be pursued by DARPA under the conferees' agreement include projects to identify people at a distance by using radar or video images of their gait or facial characteristics.