Over breakfast one Sunday, the actor Mahershala Ali ordered a healthy egg-white omelet, studiously avoiding a basket of complimentary, carb-loaded pastries. Life is full of such choices, and as he described his decision to leave the Netflix drama “House of Cards,” it became clear that the career move represented a similar choice, between one immediately satisfying option and another that would ultimately be more sustaining.

“I was coming to terms with the idea that there’s a difference between gratitude and fulfillment,” said Mr. Ali, who earned an Emmy nomination and raves for his bristling turn as Remy Danton, a sly political chess master. “I felt grateful for the work I was getting, but I wasn’t fulfilled.”

After Mr. Ali decided to leave the show last year, his disciplined gamble paid off immediately. Now he is being celebrated for career-redefining roles in two of this fall’s most prominent screen projects: “Moonlight,” which opened Oct. 21, and was one of the year’s best-reviewed films, and the superhero series “Marvel’s Luke Cage.” On Tuesday he was nominated for an Oscar for best supporting actor for his “Moonlight” performance.

Mr. Ali’s rise has not been meteoric. It is the result of a hard-fought and patient two-decade campaign. He grew up in Oakland, Calif., and attended St. Mary’s College nearby, where he was one of a few African-American students and the only varsity basketball player who also performed in poetry slams. He discovered a love of theater in two college plays, and after completing N.Y.U.’s graduate acting program, he landed a 19-episode run on “Crossing Jordan” from 2001 to 2002 as the polished Dr. Trey Sanders.