Composer Marvin Hamlisch, who penned the scores for movies including “The Way We Were” and musicals including the Broadway smash “A Chorus Line,” winning all four of the major awards — Oscar, Tony, Emmy and Grammy — in the process, collapsed and died Monday in Los Angeles after a brief illness. He was 68.

The composer was at work on a variety of projects. He was scheduled to fly to Nashville this week to see a production of his musical “The Nutty Professor,” directed by Jerry Lewis. He was also working on a new musical, “Gotta Dance,” and was to write the score for Steven Soderbergh’s Liberace biopic for HBO, “Behind the Candelabra.” Hamlisch’s latest film credit was the score for Soderbergh’s 2009 film “The Informant!”

Hamlisch composed, conducted and arranged music ranging from symphonies to R&B hits in a career that saw him win three Academy Awards, four Emmys, four Grammys and a Tony. He also won a Pulitzer Prize; Richard Rodgers is the only other person to have won those five awards.

Hamlisch’s 40 film scores included those for “Sophie’s Choice,” “Ordinary People” and “Take the Money and Run.”

The composer’s most successful period were the years 1974-75.

He had an extraordinary night at the Oscars in 1974, winning three Oscars, for his adaptation of Scott Joplin’s music for “The Sting,” for his original score for “The Way We Were” and for the song “The Way We Were.” (He was Oscar nominated eight other times.)

On Broadway, Hamlisch received both a Tony and the Pulitzer Prize in 1975 for the long-running favorite “A Chorus Line” and wrote the music for “The Goodbye Girl” and “Sweet Smell of Success.”

He won four Grammys in 1974, including best new artist and song of the year for “The Way We Were,” performed by Barbra Streisand.

“I’m devastated,” Streisand said in a statement Tuesday. “He’s been in my life ever since the first day I met him in 1963, when he was my rehearsal pianist for ‘Funny Girl.’ He played at my wedding in 1998… and recently for me at a benefit for women’s heart disease. When I think of him now, it was his brilliantly quick mind, his generosity, and delicious sense of humor that made him a delight to be around.”

Two of Hamlisch’s Emmys were for his work on Streisand’s HBO special “Barbra: The Concert,” and one of Hamlisch’s Oscar nominations was for a song he co-wrote with Streisand and others for her film “The Mirror Has Two Faces.”

Hamlisch also found success in the pop world beyond “The Way We Were.” He wrote the No. 1 R&B hit “Break It to Me Gently” with Carole Bayer Sager for Aretha Franklin. Also with Bayer Sager, he wrote the popular song “Nobody Does It Better,” performed by Carly Simon, for the James Bond film “The Spy Who Loved Me.”

“I will forever remember our collaboration with Neil Simon on ‘They’re Playing Our Song,’ and how years before, he went to bat to allow me to write the lyrics to ‘Nobody Does It Better’ for ‘The Spy Who Loved Me,'” said Bayer Sager.

He co-wrote “One Song” sung by Tevin Campbell and produced by Quincy Jones, and “I Don’t Do Duets” sung by Patti LaBelle and Gladys Knight.

“The Way We Were” exemplified Hamlisch’s old-fashioned appeal — it was a big, sentimental movie ballad that saw huge success even amidst the rock era. He was extremely versatile, able to write for stage and screen, for soundtracks ranging from Woody Allen comedies to a somber drama like “Ordinary People.”

On a panel at the World Soundtrack Awards in Ghent, Belgium, in 2009, Hamlisch reflected on the movie scoring craft.

“The only way I like to write is either if you are granted by God a great title of a film like ‘The Way We Were’ and you go, ‘I can write that.’ Or, you see a film and as you’re walking on the streets of New York, or, God willing, Paris, the beauty is you’re thinking about that film and those things and that’s when all the stuff you’ve learned at school starts to play and you start your language. And I think that’s the glory of film music.”

Amid his extraordinary successes in the mid-’70s, Hamlisch also found time to serve as accompanist and straight man when Groucho Marx toured in 1974-75.

Hamlisch was born in New York, and his interest in music started early. He entered the Juilliard School of Music at age 7, stunning the admissions committee with his renditions of “Goodnight Irene” in any key desired. (He later graduated from Queens College.)

In his autobiography, “The Way I Was,” Hamlisch admitted that he lived in fear of not meeting expectations of his father, a Vienna-born accordionist and bandleader. “By the time Gershwin was your age, he was dead,” the Viennese-born musician would tell his son. “And he’d written a concerto. Where’s your concerto, Marvin?”

In his teens, he switched from piano recitals to songwriting. Show music held a special fascination for him. Hamlisch’s first important job in the theater was as rehearsal pianist for the Broadway production of “Funny Girl” with Streisand in 1964. He graduated to other shows including “Fade Out-Fade In,” ”Golden Rainbow” and “Henry, Sweet Henry,” and other jobs like arranging dance and vocal music.

“Maybe I’m old-fashioned,” he told the Associated Press in 1986. “But I remember the beauty and thrill of being moved by Broadway musicals — particularly the endings of shows. The end of ‘West Side Story,’ where audiences cried their eyes out. The last few chords of ‘My Fair Lady.’ Just great.”

Hamlisch also had a place in popular culture. His image — nerdy look, complete with thick eyeglasses — was sealed on NBC’s “Saturday Night Live” during Gilda Radner’s “Nerd” sketches. Radner, playing Lisa Loopner, would swoon over Hamlisch.

Hamlisch was principal pops conductor for symphony orchestras in Pittsburgh, Milwaukee, Dallas, Pasadena, Seattle and San Diego at the time of his death. He was due to lead the New York Philharmonic during its New Year’s Eve concert.

The marquees of Broadway theaters in New York will be dimmed in his memory tonight at 8 p.m.

He is survived by his wife of 25 years, Terre.

(Associated Press contributed to this report.) MARVIN HAMLISCH: 1944-2012