James Foley, a veteran director whose films included “Glengarry Glen Ross” and the “Fifty Shades of Grey” sequels, and who also worked on the hit television series “House of Cards,” died this week at his home in Los Angeles. He was 71.

His death came after a yearlong battle with brain cancer, according to Taylor Lomax of ID, the firm that represents Foley.

Foley made his directorial debut with the 1984 film “Reckless,” a drama about a high school romance between a rebellious, motorcycle-driving football player and a cheerleader. In the decades that followed, he built a career directing movies, television shows and music videos, working with some of Hollywood’s biggest stars.

Among his most celebrated works is the 1992 film adaptation of “Glengarry Glen Ross,” the play by David Mamet that won the Pulitzer Prize for drama in 1984. The movie, about real estate salesmen trying to make ends meet in a tough economy, starred Al Pacino, Jack Lemmon, Alec Baldwin, Ed Harris and Alan Arkin.

Foley also directed “Fifty Shades Darker” (2017) and “Fifty Shades Freed” (2018), the final two installments of the “Fifty Shades of Grey” franchise. Those films were adapted from the second and third books of the E.L. James trilogy.

Foley told the The Hollywood Reporter in 2017 that he was pleased that his career had not been pigeonholed.

“I think in terms of what fascinates me and what intrigues me and what I feel is engaging for the year that you spend making the movie, what’s personally engaging, not adhering to any kind of conventions,” Foley said.

James Foley was born Dec. 28, 1953, in New York City and grew up on Staten Island. He studied psychology and graduated from the State University of New York at Buffalo in 1974. He planned to attend medical school, but he decided instead to pursue directing after taking a six-week film production course at New York University. He went on to earn a Master of Fine Arts at the University of Southern California’s School of Cinematic Arts in 1979.

Foley recalled screening the short film he made during the six-week course in New York while speaking to film and media studies students at Johns Hopkins University in 2013.

“That was the first time that something I had done got a reaction out of a lot of people,” Foley said. “From that moment on, I decided I wanted to do that again.”

Foley directed “At Close Range,” the 1986 crime drama starring Sean Penn and Christopher Walken. Several years later, he directed and co-wrote the 1990 film adaptation of “After Dark, My Sweet,” the crime novel by Jim Thompson. His directorial credits also include “Fear”(1996), starring Mark Wahlberg and Reese Witherspoon; “The Chamber” (1996), with Chris O’Donnell and Gene Hackman; and “Perfect Stranger” (2007), with Halle Berry and Bruce Willis.