WASHINGTON (AP) _ J. Skelly Wright, whose 38-year career as a federal judge included decisions on major cases balancing individual rights and government power, has died at age 77.

Wright, who participated in the Pentagon Papers case and wrote the decree ending de facto segregation in the nation's capital, died Saturday of cancer.

He had retired last year after 25 years on the U.S. Court of Appeals here - two as chief judge - and 13 years as a U.S. District judge in his native New Orleans.

Wright, whose full name was James Skelly Wright, graduated from Loyola University Law School in 1934 and became an assistant U.S. attorney three years later. Following military duty in London, Wright returned to New Orleans to practice law before being named U.S. attorney in 1948.

The next year, at the age of 38, he was appointed to the U.S. District Court, becoming the youngest man to hold the post at that time.

After his 1960 order desegregating the New Orleans school system drew threats against his life, President Kennedy reassigned Wright to Washington, D.C.

In 1967, Wright's order overturned the District school system's racially separate ''tracking system'' for grouping students. The ''Wright decree,'' in addressing de facto segregation, was considered one of the most significant education rulings since the 1954 Supreme Court decision outlawing the doctrine of ''separate but equal'' schools.

In the 1971 Pentagon Papers case involving an attempt by the government on national security grounds to restrain publication of military documents by The Washington Post, he dissented from the ruling of two other judges on a three- member appeals court panel.

In favoring the right of the newspaper to publish, he wrote: ''To allow a government to suppress free speech simply through a system of bureaucratic classification would sell our heritage far, far too cheaply.''

Survivors include his wife, Helen, a son, James Skelly Wright Jr., one brother, James Edward Wright Jr. of New Orleans, and three sisters, Rosemary Ruckert and Katherine Hotard of New Orleans and Margaret Hewes of Birmingham, Ala.