Gen. David M. Shoup, 78, a former commandant of the Marine Corps, a winner of the Medal of Honor and an early and articulate critic of the war in Vietnam, died of a heart ailment Thursday at the Circle Terrace Hospital in Alexandria.

Gen. Shoup held the view that the military must serve the interests of the nation as defined by the civil power. He also supported the tradition that military leaders must help define those interests without reference to the special objectives or ambitions of their own services. He clung to these ideals at a time and in a fashion that offended many of his peers in uniform and policy makers in the highest circles of government.

"Somewhat like a religion, the basic appeals of anticommunism, national defense and patriotism provide the foundation for a powerful creed upon which the defense establishment can build, grow and justify its cost," he and Col. James A. Donovan said in an article published in The Atlantic Monthly and The Washington Post in 1969.

"Warfare becomes an extension of war games and field tests. War justifies the existence of the establishment, provides experience for the military novice and challenges the senior officer. Wars and emergencies put the military and their leaders on the front pages and give status and prestige to the professionals."

Applying his principles to Vietnam, Gen. Shoup maintained that nothing justified a massive buildup of American forces in Southeast Asia. He made this point repeatedly during his years as commandant from 1959 to 1963 under presidents Eisenhower and Kennedy. He continued to speak out in his retirement when President Johnson escalated the war.

Gen. Shoup was outspoken on other issues as well. He told President Kennedy that he had had no advance knowledge of the ill-starred invasion of Cuba at the Bay of Pigs in 1961. If he had, he said, he would have wanted to know who was responsible for such poor ideas. Shortly before he was assassinated in November 1963, Kennedy advised Gen. Shoup that he wished to make him the head of the Central Intelligence Agency.

The general's own experience of war was intense. In World War II, he was a colonel in the Second Marine Division. He was the senior officer ashore in the invasion of Tarawa, one of the bloodiest actions of the Pacific campaign. Marines were forced to wade through hundreds of yards of chest-deep water to reach the tiny island of Betio, which was strongly held by Japanese troops. In the three days that the battle lasted, the Marines lost 948 dead and 2,072 wounded.

The future commandant was among the wounded. He was hit in the leg by shrapnel during the first day, but directed the fight until it was over. For this he received the Medal of Honor, the nation's highest award for gallantry. The accompanying citation read it part:

"By his brilliant leadership, daring tactics, and selfless devotion to duty, Col. Shoup was largely responsible for the final decisive defeat of the enemy, and his indominatable fighting spirit reflects great credit upon the U.S. Naval Service."

David Monroe Shoup was born Dec. 30, 1904, at Battle Ground, Ind. He graduated from DePauw University in 1926 and was commissioned in the Marine Corps. His service included duty with the 4th Marines in Shanghai, China, in the 1930s.

Early in World War II, he was a staff officer in the 2nd Marine Division. He observed operations in New Georgia and the Solomons in 1943. The action at Tarawa was fought from Nov. 20 to Nov. 22, 1943. Gen. Shoup later served in the Marianas and in Washington.

His postwar service included duty at the Marine Corps Recruit Depot at Parris Island, S.C., following an incident in which several recruits were drowned in a training exercise. Promotion over more senior officers followed quickly and Eisenhower chose him to be commandant beginining Jan. 1, 1960.

Among his actions as head of the Corps were orders concerning swagger sticks, the short leather-covered canes affected by officers at that time. Gen. Shoup decreed that those who felt they needed these anachronisms could keep them. They immediately disappeared in the Marine Corps. Another order ended the old practice of escorting court-martialed Marines off of posts with drummers playing a death march.

Called to testify in connection with the activities of Army Maj. Gen. Edwin Walker in indoctrinating troops in Europe, Gen. Shoup told Congress that the Marine Corps felt there was no reason to instill hate in its troops.

"We teach them what there is in this country worth living for, worth fighting for, worth giving your life for," he said.

Gen. Shoup, who lived in Arlington, was a poet in private life.

Survivors include his wife, Zola D., of Arlington; two children, Carolyn LaMar of Chapel Hill, N.C., and Robert, of Alexandria, and four grandchildren.