President Mohammed Zia ul-Haq today toughened his stance against border violations and said his armed forces would move against either Soviet or Afghan troops who cross into Pakistani territory in pursuit of Moslem rebels.

In the past, Pakistan has limited itself to stiff diplomatic notes when Afghan planes violated its air space by flying over territory that juts into Afghanistan or when, last March, Afghan artillery lobbed 60 shells into a rebel camp inside this country.

But Zia tempered his new tough stance with hints later in a news conference that Pakistan has been holding secret meetings with the Soviets while lecturing the Western world about the threat of Russian expansion and negotiating a new arms agreement with the United States.

U.S. officials said in Washington Monday that the United States has offered Pakistan $200 million in military sales credits and $200 million in economic aid over two years.

"The Soviet Union is on our doorstep, and the United States of America is 10,000 miles away," said Zia. "We ought to view the situation very pragmatically. You can't live in the sea and create enmity with whales. You have to be friendly with them."

But Zia also made it clear he was not prepared to be friendly to any forces that move into Pakistan territory.

When a foreigner enters your territory with aggressive intent," Zia said, "you do not go and kiss him on the cheek." Then, to underscore his point, he asked, "Do I make myself clear?"

Later, Zia, who is also Army chief of staff, added that Pakistan's Army "is capable of defending its borders against any aggressor."

Zia's statement came amid growing rumors here and in the border city of Peshawar that the Soviets would either move themselves or send loyal Afghan army units against Afghan rebel camps in Pakistan.

Many of these camps are in tribal territory on the ruggedly mountainous border between the two countries, where the Pakistani government has no effective control. Pakistani officials and tribal chiefs deny that there are guerrilla camps there, but it is generally acknowledged that rebels come into Pakistan for rest, food, ammunition and medical care.

There are about 3,500 hidden roads and trails over the border between the two countries, and Pakistani authorities say they are impossible to patrol.

Zia said again that Pakistan would not provide military aid to the rebels, whom he instructed a reporter to call "freedom fighters" and he denied that Pakistan was being used as a sanctuary.

While clearly enjoying his new prominence heading a country in the center of a world crisis and using it to lecture Western leaders on geopolitics, Zia, in his statements today, indicated that he believes Pakistan's position is perilous.

Unless it receives a large supply of modern weapons as well as the promise of a quick Western response to any attack, there is no way that Pakistan can stand up to the Soviets on its borders.

At the same time it feels it vulnerability to attack from India to the east has increased and it wants to be assured that any weapons and mutual defense pacts will help in any war -- not just against the Soviets.

"Pakistan doesn't want to be left with the Soviets on the west and the Indians on the east. If we don't get enough U.S. aid to meet the Soviet threat, than we will have to look to the Soviets," said one government official.

In answer to questions today, Zia said Pakistani and Soviet officials had held talks since the Soviet move into Afghanistan but he said it would be premature to give details about the talks.

While clearly worried about Indira Gandhi's new Indian government, Zia tried today to assure India that Pakistan wants to be its friend despite three wars since the two countries were carved from British colonial India 32 years ago and given independence.

He said he had called Gandhi and looked forward to continuing the normalization of relations between the two neighboring countries that she started when she was prime minister before and that continued in the government of Morarji Desai.

"We want to live and let live as good neighbors," he said. "We have no ill intents or ill designs against any neighbors, especially India, which is a much bigger neighbor."

The mere talk of increasing foreign arms supplies to Pakistan has alarmed India, which sees the Soviet takeover of Afghanistan as no threat to any other nation.

In today's news conference, his second in three days, Zia would give no details on U.S. aid offers or Pakistan's needs and called talks in Washington last week between his foreign affairs adviser, Agha Shahi, and U.S. Secretary of State Cyrus Vance "preliminary."

He said that the United States had not attached strings to any aid offer, such as an end to what Washington claims is Pakistan's clandestine nuclear weapons program or an end to the Army-run martial-law regime and the holding of free elections.

Although U.S. officials have said only that a $400 million aid package is being prepared for Pakistan, there have been reports here and in Washington that $1 billion will be offered.

The Muslim, a leading Pakistani newspaper, referred to the reported $1 billion package, saying "Observers here called it a good beginning if correct," but the paper added that a meaningful updating of Pakistan's defenses would cost at least $4 billion.

Zia said that British foreign secretary, Lord Carrington, who had talks here today with Zia and other top Pakistani officials as part of a swing through the area, could play a role by "generating correct thinking in the right circles in the Western world."

Once again, he praised China, whose Foreign Minister Huang Hua opens a four-day visit here Friday, as a loyal friend which "has stood by Pakistan in all critical events."

"We do not have to ask our Chinese friends for military assistance," he said pointedly, 'because they already have given it to us."