Leonard Bernstein, 72, a giant in the American musical community who was simultaneously one of this nation's most respected and versatile composers and preeminent conductors, died yesterday at his Manhattan apartment.

He died in the presence of his physician, who said the cause of death was sudden cardiac arrest caused by progressive lung failure.

On the advice of the doctor, Kevin M. Cahill, Bernstein had announced through a spokeswoman Tuesday that he would retire from conducting. Cahill said progressive emphysema complicated by a pleural tumor and a series of lung infections had left Bernstein too weak to continue working.

For more than four decades, Bernstein had been at home on the podium of concert halls all over the world, and he was the first conductor born in the United States to achieve a major international reputation. Critics said he had a charisma that both inspired his musicians and delighted his audiences, and his music seemed to communicate with extraordinary power.

As a composer, he had a versatility that encompassed both stage and concert hall. He was author of the scores for such Broadway hit musicals as "West Side Story," "Wonderful Town," "On the Town" and "Candide"; the score for the 1954 movie "On the Waterfront"; and "Mass" for the 1971 opening of the Kennedy Center in Washington.

For the concert hall, he wrote pieces based on Hebrew religious literature, the "Kaddish" and "Jeremiah" symphonies and "Chichester Psalms." He took the poems of W.H. Auden as his inspiration for "Age of Anxiety," and the work of 13 American poets who wrote from the mid-17th century to the present as his inspiration for "Songfest." The dialogues of Plato were the basis for his "Serenade" for solo violin and orchestra.

His score for "West Side Story," a loose adaptation of Shakespeare's "Romeo and Juliet" set in modern-day New York City, was probably the most popular and, in the view of many critics, the best of his compositions. Made into a 1961 movie, the musical won 10 Academy Awards, including best picture of the year.

Bernstein was musical director and chief conductor of the New York Philharmonic Orchestra from 1958 to 1969, and in that period he brought about vast improvements in its playing style and technique. Its broadcasts and recordings became widely popular, and under Bernstein's direction the orchestra presented a repertoire and musical interpretation that had not previously been offered to American audiences.

As a 25-year-old assistant conductor of the New York Philharmonic, Bernstein electrified the musical community on Nov. 14, 1943, when he was called upon at the last minute to replace the scheduled guest conductor, Bruno Walter, who was ill with the flu. Bernstein had not rehearsed for the concert, but his conducting dazzled the audience, won the praise of critics and got him a page one story in the next day's editions of the New York Times.

That tour de force earned him instant credibility as a musician of extraordinary talent, and it moved his career onto a fast track that carried him to the pinnacle of American music before he was 40.

Bernstein was also a gifted pianist and an exciting teacher. He was author of a best-selling book, "The Joy of Music," published in 1959, and he gave lectures on the meaning and theory of music on television and at Harvard University. Because of this, he was sometimes called "music's most articulate spokesman." He also conducted on television, and to a generation of viewers his voice and face were as familiar as his recordings were to millions of record collectors.

His television success stemmed in part from the fact that he looked and acted as most people thought a conductor should. He had a flowing mane of black hair that turned white as he grew older, and his conducting sometimes seemed to be a frenzy of motion, with Bernstein jumping and gyrating, crouching and springing without ever leaving the podium. He often sang along with the orchestra. "He shagged, shimmied and, believe it or not, bumped," music critic Virgil Thomson once observed.

After retiring as director of the New York Philharmonic, Bernstein became the only American conductor trained exclusively in the United States to have conquered Europe musically with a repertoire of classical European music.

But in fact he began conducting internationally soon after World War II. In May 1947, he went to Jerusalem to conduct the Palestine Symphony. He returned the next year to conduct the orchestra in a series of outdoor concerts, many of which were held within earshot of the fighting that took place after the partition of Palestine and the creation of the state of Israel. He led the London Philharmonic in 1946 and the Orchestre National de Paris in 1950. In 1953, he became the first American to conduct at La Scala in Milan.

With the New York Philharmonic, he toured South America, Asia and Europe, including the Soviet Union, where the Russians received him enthusiastically. "They thought nothing of waiting at the stage door for an hour in the pouring rain just to touch my coat or kiss my hand," Bernstein recalled.

He was a figure of tremendous energy and vitality, and he loved the perquisites of his position. It delighted him to put on his white tie and tails and to step up to the conductor's podium in front of an audience. He hated criticism and was said by Time magazine in a 1958 cover story to have suffered from a "pre-Copernican ego" -- a tendency to believe that the world revolved around him.

Everything he did seemed to pique the interest of the news media. He gave a fund-raising party for the Black Panthers at his posh New York duplex apartment in 1969 that drew widespread coverage. Author Tom Wolfe later wrote about it in New York magazine, and he used the occasion to coin the phrase "radical chic."

As Bernstein grew older, stories appeared in magazines and newspapers about what was said to be his use of drugs and alcohol. A 1987 book, "Bernstein: A Biography," by musicologist Joan Peyser, discussed what it indicated to be his bisexuality.

Some critics said the quality of his composing declined in his later years. A much-touted Bicentennial musical, "1600 Pennsylvania Avenue," drew scathing reviews and closed after five New York performances and a loss of $1 million in May 1976. A 1983 opera, "A Quiet Place," attracted almost no interest or attention.

Leonard Bernstein was born in Lawrence, Mass., on Aug. 25, 1918, and he grew up in Boston. He had no formal musical training until he was 10, when his family acquired an old upright piano from a relative. The young Bernstein took an instant liking to it. He studied piano in Boston under a teacher named Helen Coates, who recognized almost immediately that she had a pupil of unusual talent. Years later, after Bernstein had become established as a successful musician, he hired Coates as his secretary, and for a time she lived in his New York apartment with his family.

By the time he was 16, he was performing as a piano soloist with the Boston Public School Orchestra while excelling in both studies and athletics at Boston Latin School. He had decided by then that he wanted a career in music, over the strong reservations of his father, Samuel Bernstein, who remembered that most musicians in the Jewish ghettos of his native Russia got only an occasional free meal as compensation for their work.

"How could I know he would grow up to be Leonard Bernstein?" the elder Bernstein would later remark.

Bernstein studied piano and composition at Harvard. While there he had a chance encounter with Dimitri Mitropoulos, then conductor of the Minneapolis Symphony, who suggested that he train to become a conductor.

When Bernstein asked why, Mitropoulos replied, "I just sense it."

After graduating from Harvard in 1939, Bernstein spent two years at Philadelphia's Curtis Institute studying conducting and orchestration. He spent his summers during this period at Tanglewood music center in Massachusetts's Berkshire Mountains, studying conducting under Serge Koussevitzky, conductor of the Boston Symphony Orchestra.

It was at Tanglewood that Bernstein caught the eye of Artur Rodzinski, then musical director of the New York Philharmonic Orchestra, who hired him as an assistant conductor for the 1943-44 season. His triumphant performance as a last-minute substitute for Bruno Walter earned him several subsequent appearances as conductor on the Philharmonic podium and got him an appointment in 1945 as director of the New York City Symphony Orchestra, a job he held for three years.

His "Jeremiah Symphony," which he conducted in Boston, Pittsburgh and New York, was the first of his compositions to win popular acclaim, and it won the award of the Music Critics Circle of New York for the most outstanding orchestral work by an American composer during the 1943-44 season. During the next two years he wrote the music for two popular ballets, "Fancy Free" and "Facsimile," both of which were choreographed by Jerome Robbins. In December 1944 his first musical, "On the Town," opened on Broadway.

In the summer of 1948, Bernstein joined the faculty at Tanglewood, and he succeeded Koussevitzky as head of the conducting department in 1951. He taught music at Brandeis University in Massachusetts from 1951 to 1956. He also gave lectures on music on the Ford Foundation's television program, "Omnibus," during the 1950s.

With Koussevitzky he shared conducting assignments for the Israel Philharmonic Symphony Orchestra's 1951 American tour, and he conducted the Israel Philharmonic at its first concert in the new Fredric H. Mann Auditorium in Tel-Aviv in 1957.

When Bernstein became musical director and chief conductor of the New York Philharmonic in 1958, he also began a series of national television appearances, "Leonard Bernstein and the New York Philharmonic," broadcast over CBS. He retired from the New York Philharmonic in 1969 and at that time became laureate conductor for life. He continued to make periodic appearances on the orchestra's podium as a guest conductor.

At the request of Jacqueline Kennedy Onassis he wrote "Mass," based on the language and liturgy of the Roman Catholic Mass, for the 1971 opening of the Kennedy Center. It was received enthusiastically in Washington, and it was later performed at other cities in the United States and in Europe and Asia, but not everyone liked it.

The Rev. Gilbert Hartke, chairman of the drama department at Catholic University, described it as "the work of a mind which neither understands nor believes in the Mass," and the music critic of the New York Times called it a "pseudo-serious effort . . . cheap and vulgar . . . a show-biz Mass."

Bernstein was back in Washington in January 1973 at the time of Richard Nixon's inauguration to a second term as president, but he was not in the nation's capital to participate in the inaugural festivities.

At the time of the inaugural concert at the Kennedy Center, Bernstein led a hastily assembled 50-piece orchestra of local musicians and 125 singers in a performance of Joseph Haydn's "Mass in Time of War."

A crowd estimated at 9,000 to 12,000 opponents of the war in Vietnam packed Washington Cathedral to hear it or stood outside in the rain to listen over a public address system.

In 1974 he teamed up with Jerome Robbins once again on a ballet, "Dybbuk," based on an old Yiddish folk story. Bernstein wrote the score while Robbins did the choreography.

"I am a fanatic music lover," Bernstein once said. "I can't live one day without hearing music, playing it, studying it or thinking about it. And all this is quite apart from my professional role as a musician."

In 1951 Bernstein married Chilean actress Felicia Montealegre Cohn. She died in 1978. They had two daughters, Jamie and Nina, and a son, Alexander.