Mexico's secretary of the Navy has likened President Jose Lopez Portillo to the nation's greatest heroes. The secretary of defense said to him, "You know very well how to command."

In the weeks since Lopez Portillo took the radical step of nationalizing Mexico's banks as a response to the country's economic crisis, leading military officers have come forward repeatedly as loyal backers of the measure and the man who took it.

But Lopez Portillo has less than 10 weeks left in office. His 72-year-old defense minister, Gen. Felix Galvan Lopez, is expected to retire soon after President-elect Miguel de la Madrid takes power on Dec. 1. The new president is expected to impose economic austerity that could provoke serious social unrest.

The direction the Army will follow then and the political force it may wield are the subject of growing, sometimes anxious speculation among Mexican officials, foreign diplomats and some Army officers.

The current strength of Mexico's military is like nothing the nation has seen for decades. There are suggestions that its officers are showing this power as they reiterate their loyalty to established institutions -- including the almost monolithic ruling party and bureaucracy through which it rules.

At the recent celebration of Mexico's declaration of independence, new American-built F5 jet fighters ripped across the skies and more than 39,000 soldiers -- a quarter of Mexico's men in uniform -- marched through the heart of the city in the biggest peacetime concentration of military force ever seen here.

Few people connected with the Army take seriously the oft-circulated rumors of coup plots, at least for the moment.

"The Army doesn't feel threatened at this time. The institutions are not threatened. The presidency is not threatened," said one source with close ties to the high command. "What causes the military to put its hands into the cookie jar is when the institutions are threatened."

But by the same token, Mexico's financial crisis seems to have come on so fast, Lopez Portillo's response to it appears in some instances to have been so radical, and the prospect for respite from economic and social problems seems so remote, that few observers feel confident in predicting the nation's course over the next year.

The Army is rigidly disciplined, the chain of command strictly linear from top to bottom. There is a new law in the works, moreover, that would abolish any reprieve for a soldier who disobeys an order, even if he firmly believes that order to be unconstitutional.

If the top commander stands with the president, as Galvan Lopez is doing now, there appears little chance for insubordination, much less a revolt. But this same rigid structure, some Western diplomats suggest, could make any coup planned by top officers that much easier to carry out.

It is almost traditional at the end of a presidential term in Mexico for conspiracy rumors to hang thick in the air, but as each new head of state takes office he has found ways of making sure the Army remains his faithful ally.

Lopez Portillo showed a particulary shrewd sense of the way Latin armies think and work in his six years as president and commander in chief. But he and those before him came to power facing a less sophisticated military than he will leave behind -- and he had financial resources to devote to the armed forces that de la Madrid is not expected to have at his disposal.

According to Mexican and Western officials with close ties to senior officers, three generals are likely candidates to be defense minister. That office is the pinnacle of the armed forces here, rather than the Army commander as in many other countries.

The most prominent contender is Gen. Juan Arevalo Gardoqui, who led the recent parade as commander of the First Military Zone, which includes Mexico City.

Gen. Alonso Aguirre, director of military industries, has had an influential role in the attempts to modernize the Army and is considered by some diplomats to be particularly friendly to the United States.

Gen. Victor Manuel Ruiz Perez, commander of the cavalry, may have the inside track, however, on the basis of a winning personality and family connections. One brother, Brig. Gen. Leobardo Ruiz Perez, is de la Madrid's physician. Another, Guillermo, was given a prestigious assignment recently, attached to the embassy in London, according to diplomatic sources.

"I think he [de la Madrid] will pick someone easy to get along with. At this point he doesn't want a fight," said one well-informed diplomatic source.

Asked about the speculation surrounding his successor, Galvan Lopez told Mexican reporters that the law prohibited any comment on "political affairs." Such serious talk of political maneuvering in the Army would have been unlikely until recently.

From the end of the revolution in 1917 until Miguel Aleman took office in 1946, Mexico was dominated by military men. But the 1950s and 1960s saw a steady deterioration in military prestige and, in concrete terms, armament and training. For more than 30 years, the armed forces, unlike those of many Latin countries, were at the edge rather than the center of political life.

Lopez Portillo, with money fresh from the oilfields, began to change that when he came to power in 1976.

As the parade showed, the Army is still equipped with a lot of antiques. But soldiers who once slouched along the route now look hard and fit; a ceremonial horse cavalry was followed by more than 80 new French Panhard armored vehicles mounted with 90 mm guns; the sky was filled with the little propeller-driven trainers and old airline planes that make up the bulk of the Air Force, but there were also the seven F5s -- shortly to be a full dozen.

Under Lopez Portillo, the quality of military education improved, salaries grew. By instituting a pension policy that could triple a top officer's salary if he stepped out of active service, he eliminated the bottleneck in promotions that often causes discontent among junior officers and leads to coups in Latin armies.

Lopez Portillo was careful to bring Galvan Lopez into most major decisions. According to government officials, the defense minster was told of the move to nationalize the banks hours before the treasury minister, and was the only Cabinet member not called on to vow his support for the measure at a meeting the night before the announcement.

Under Lopez Portillo, the Mexican armed forces -- once widely dismissed as ineffective, or denounced by the left for their part in forced removals of rural squatters and pursuit of other dissidents, have gained prestige and popularity for their rescue operations during such natural disasters as the eruption of El Chichon volcano last year and the ongoing war against marijuana and poppy growers.

But if today's economic problems greatly aggravate Mexico's already tense social and political pressures, "the situation could be very volatile," said a source close to the Mexican high command.