Defense Secretary Caspar W. Weinberger said yesterday that the United States will not allow terrorism to "shut the doors of democracy," but cautioned against the use of U.S. military power unless "vital interests" are at stake.

In an address delivered to the Comstock Club in Sacremento, Weinberger said that while the United States "cannot substitute our troops or our will" for those of its allies, it should support them with "substantial amounts of economic and military assistance," including deployment of U.S. troops.

But, he said, "military power should only be used in support of diplomatic objectives if our vital interests are threatened," if combat forces are deployed "in sufficient strength to win" and if the American public backs the operation.

Weinberger's remarks, which Pentagon officials said were cleared by the White House, come at a time of increasing administration warnings against terrorists in the Middle East and Central America.

The defense secretary, who has previously prescribed limits on the exercise of U.S. military power, noted that the United States is a "democratic model in an assertively chaotic world" threatened by the "old totalitarian technique" of terrorism. But, he added, "it would be misleading to claim that we as a nation are absolutist in pursuit of our principles. As always, the pursuit . . . must be tempered by our capabilities and interests.

"Our ability to influence foreign events may be somewhat limited in a world torn by religious and social upheaval," he said. "Violence in many parts of the world is endemic. This does not signal a slackening of our global responsibilities because isolationism never was and never will be a practical model for American foreign policy."

"We do not, nor will we ever, have a strategy of global interventionism, but we do, and should, have a strategy of global assistance to our friends and allies."