Aimee Berg

Special to USA TODAY Sports

NEW YORK – Sunday’s New York City Marathon promised plenty of drama, but not like this.

When the day began, everyone knew it would be the 26th and final professional race for Meb Keflezighi, one of the greatest male American marathoners of all time. But no one knew that Shalane Flanagan would foil a four-peat attempt by Mary Keitany of Kenya, win her first major marathon title, and become the first able-bodied American woman to win the race in 40 years, in 2:26:53.

Flanagan, 36, was racing for the first time this year after injuring her left hip in January. In hindsight, she said the break proved to be beneficial.

“I had no physical limitations today,” she said. “I felt good… It was a pretty flawless race for me.”

After covering the first half of the race in 1:16:18 in a 13-woman pack, Flanagan, Keitany, and Mamitu Daska of Ethiopia, broke away with a 5:26 mile between mile 20 and 21 – the fastest mile to that point. Flanagan covered the 23rd mile in 5:11, and the 24th mile in 5:04 to build a 28-second lead over Keitany with one mile to go.

Keitany would ultimately finish second, one minute, 1 second after Flanagan. Daska was third in 2:28:08.

More:Geoffrey Kamworor of Kenya wins men's New York City Marathon

More:New York marathon fans reveal immense pride in wake of terror attack

After the race Flanagan said she thought about two things while she was running the final miles alone. One was Keflezighi.

“He’s been the absolutely the best role model for all of us,” she said. “He was a part of healing Boston after the bombings in 2014, and that’s my hometown. His performance meant the world to me. I wanted to make him proud today. Today, I just thought: be like Meb as much as you can.”

The other was the terrorist attack five days earlier in which a man plowed a truck onto a bike path in lower Manhattan, killing eight people. The event, which officials called the worst terror attack on the city since September 11, 2001, caused race organizers to step up security to a new level.

As Flanagan finished, she said, “I was thinking how amazing that Meb was able to be that clutch person in 2014 and how now I’ve been presented with the opportunity to be that person for New York.”

With the victory, Flanagan may end up emulating Keflezighi in another way. Not only did both make their marathon debuts in New York City (he in 2002, she in 2010), but Flanagan had strongly hinted earlier in the week that if she were to win Sunday’s race, it might be her last marathon.

After the race, however, Flanagan was too elated to confirm that. “I’ll sit with my coach tonight,” she said. “I think we’ll have some decisions to make.”

Flanagan wasn't the only runner who had a banner day.

Beverly Ramos, a professional marathoner from Puerto Rico who continued to train at home in the aftermath of Hurricanes Irma and Maria, finished 24th, in 2:46:45.

In the men’s race, Kenya went 1-2, led by Geoffrey Kamworor, the 2015 New York City runner-up, who made his decisive move at mile 24 and covered the penultimate mile in 4:31 to win his first marathon in 2:10:53. His countryman, Wilson Kipsang of Kenya, finished three seconds later. Lelisa Desisa of Ethiopia placed third. Forty-year-old Abdi Abdirahmman was the top American man, placing seventh in 2:12:48 despite falling at the very first water stop.

Keflezighi, 42, stayed with the leaders and finished 11th. He said he heard about Flanagan’s victory at mile 24. “What a day for America. I think I did a jump.”

And when he crossed the finish line in 2:15:29, he collapsed. “There was no push-up today,” he said, referring to the calisthenics he did at his Olympic finale in Rio in 2016. “That was it. I gave it all that I had today. My goal was to be top-3, to be top-10. I went for it. No regrets. I did everything that I can. It was a beautiful victory lap, you could say, to be at the front, mix it up with the great runners.”

Earlier in the day, Switzerland swept the professional wheelchair divisions. Manuela Schaar won her first New York City Marathon in 1:48:09 after being runner-up to Tatyana McFadden for the past three years. McFadden placed second, unable to five-peat. Her countryman Marcel Hug defended his 2016 men’s title in 1:37:21 for his 15th major marathon victory.