WASHINGTON (AP) _ Gale McGee, a Wyoming Democrat who served nearly 20 years in the Senate and was later ambassador to the Organization of American States, died Thursday. He was 77.

McGee died at Suburban Hospital in Bethesda, Md., of pneumonia. He had been convalescing from surgery for a brain aneurism last September.

McGee's death was announced in a joint statement by the Wyoming congressional delegation.

''This was one of Wyoming's finest,'' Assistant Republican Leader Alan Simpson told colleagues in a Senate floor tribute.

Simpson noted that McGee had once been his professor at the University of Wyoming, and called him ''truly a remarkable man. ... very loved and deeply respected in the state of Wyoming.''

Gov. Mike Sullivan honored McGee last month on his 77th birthday for the contributions he had made to the state and the nation. Sullivan noted McGee's public service career and his international reputation as ''an observer and formulator of American foreign policy.''

McGee, born in Norfolk, Neb., on March 17, 1915, taught history for 20 years, including more than a decade as professor of American history at the University of Wyoming.

He won his first U.S. Senate term in 1958 in his initial bid for public office, upsetting incumbent Sen. Frank A. Barrett by a vote of 58,035 to 56,122.

McGee's committee assignments included seats on foreign relations and appropriations panels. He lost a bid for re-election bid to Republican Malcolm Wallop, now Wyoming's senior senator, and left the Senate in 1977.

McGee subsequently served both the Carter and Reagan administrations as America's ambassador to the Organization of American States, headquartered here.

In 1981, he left that office to become a private consultant in international and government affairs in Washington.

During his tenure as OAS ambassador, McGee led the U.S. delegation to four OAS General Assemblies and helped build support for the 1978 Panama Canal treaties.

In 1981 he left that office to become a private consultant in international and government affairs in Washington.

McGee is survived by his wife, Loraine; two sons; two daughters; and six grandchildren.

Private funeral services will be Saturday in Washington.