At first, the pain and disappointment were overwhelming.

Crystal Dunn was the last player cut from the U.S. women’s soccer team that won the World Cup last summer, the unlucky No. 24 on a 23-player roster. This meant she was not on the field for the team’s World Cup Final victory over Japan in front of a record television audience. This meant she was not among those honored in the New York City ticker-tape parade down the Canyon of Heroes. This meant that for the first time in her life, Dunn seriously considered quitting the game that had been her passion and focus since shortly after her family moved to Rockville Centre when she was 2.

“It was a very hard time,” Dunn recalled in a recent interview when she was visiting Long Island. “I spent a lot of days crying and contemplating, ‘Do I even want to keep playing soccer?’ Now, I think I was stupid to have those thoughts. I’m on cloud nine. I feel like everything I went through was worth it.”

Not only is Dunn one of 18 women on the U.S. Olympic team in Rio de Janeiro pursuing an unprecedented fourth gold medal, the diminutive 5-foot-1 player is poised to become one of its biggest stars.

For the first time in more than a decade, the U.S. team will be without Abby Wambach, the world’s all-time leading goal scorer who retired after the World Cup. Two other forwards — Sydney Leroux and Amy Rodrigues — will also miss the Olympics because of pregnancy. In preparation for Rio, the 24-year-old Dunn has been asked to return to her natural attacking role as part of a reconfigured front line. And she has responded. Heading into the Games, she has 10 goals in international play, making her the team’s second leading scorer behind only Alex Morgan, who has 11.

“She’s got such quickness and athleticism, and her ability to separate is special,” U.S. coach Jill Ellis told reporters at a pre-Olympic camp in Chicago. “When opposing teams are very structured defensively, you need players who can suddenly elude that first defender and create an advantage. She can get to balls and play a cross, and her service is really good eight times out of 10. Now the linchpin for her is her confidence.”

advertisement | advertise on newsday

The biggest reason for Dunn’s increased confidence, say both Dunn and her father, Vincent, is that she was able to get through a very difficult period. Vincent and Rhonda Dunn were with their daughter when she got the call from Ellis telling her that she had not made the World Cup team.

Dunn had never dealt with this kind of rejection. A Newsday Long Island player of the year her senior season, she led Rockville Centre’s South Side high school to three state championships. In her final high school game, she scored four goals in the state final. After she continued her domination at the University of North Carolina, the Washington Spirit made her the No. 1 overall pick in the 2014 draft.

“It’s so much easier when you’re on top and life is good,” Vincent said. “The question is: Can you take a big blow, get up in the morning and put your cleats on? Can you still go out and do what you love?’ She didn’t let it hold her down. She turned her life around in terms of the emotional part . . . ”

Dunn credits her Spirit teammates for helping her through what she admits was a dark time.

“I learned you can find strength being around great people,” she said. “The moment I knew I wasn’t going to go to the World Cup, my Spirit teammates came up to me and said ‘We’re sorry for your situation, but you need to snap out of it because we need you to win this year.’

@NewsdaySports

“I was like, ‘Can I have some time to mourn?’ But then I learned something about myself . . . As elite players, we don’t go through missing out on a roster very often. For me, that happening brought out the best in me. I played with a chip on my shoulder and brought my best game.”

That best resulted in her scoring a league-high 15 goals for the Spirit and being named the league’s MVP last September.

This time, when her coach called her in early July with news of who was going to the Olympics, she wasn’t afraid to take the call. She had already survived the heartbreak of failure, and had come out the other side a better player and a stronger person. And that’s the person who will take the field in Rio.

Said Dunn: “What I learned about myself is I’m a fighter.”