PARIS -- So unbeatable for so long until the closing days of Grand Slam tournaments, Roger Federer is suddenly accumulating early exits.
Federer's streak of nine consecutive quarterfinals at the French Open ended Sunday with a 6-7 (5), 7-6 (3), 6-2, 4-6, 6-3 fourth-round loss to 18th-seeded Ernests Gulbis of Latvia.
''A lot of regrets,'' Federer said. ''I just couldn't kind of figure it out.''
The 17-time Grand Slam champion had not left Roland Garros so soon since 2004, when he was beaten in the third round by Gustavo Kuerten.
After that decade-old setback, though, Federer made at least the quarterfinals at a record 36 consecutive major tournaments, a streak that ended with a second-round loss at Wimbledon last year. Federer also put together record Slam runs of 10 finals and 23 semifinals in a row when he was at his dominant best.
Now the 32-year-old Federer has bowed out before the quarterfinals at three of the last four majors.
''I think it was the biggest, probably, win of my career,'' said Gulbis, who most certainly could have dispensed with the word ''probably.''
Addressing the spectators during an on-court interview, Gulbis said: ''I'm sorry I had to win. I know all of you like Roger.''
The fourth-seeded Federer's resume includes the 2009 French Open, and he was a four-time runner-up in Paris to Rafael Nadal. Loudly serenaded and supported by the Court Philippe Chatrier crowd Sunday with singsong chants of his first name, Federer was hardly in top form. He made a whopping 59 unforced errors and was broken seven times, including twice while serving for a set.
That included at 5-3, 40-15 in the second, when Federer had set points and a chance to put away an overhead but sent the ball right to Gulbis, who took full advantage by whipping a backhand passing winner.
''Things got tough from then on for, like, a half-hour for me,'' said Federer, who also was ahead in the second-set tiebreaker, before allowing Gulbis to grab five points in a row.
After dropping the third set, too, Federer appeared to be getting back into the match until Gulbis left the court with a trainer to take a medical timeout while trailing 5-2 in the fourth. As he walked out, Gulbis motioned to Federer, as if asking for permission to go. When Gulbis returned, some fans jeered and whistled at him, and he pointed to his lower back and raised his palms, as if to say, ''Hey, I was injured.''
His strokes had momentarily gone astray before that break, but afterward, the 25-year-old Gulbis once again played the sort of free-flowing, big-hitting tennis that had many marking him as a future star when he was a teenager. He won 10 of the next 12 points, punctuating most shots with exhales that sounded like growls.
The fifth set was all Gulbis, who hadn't been to the quarterfinals at a major tournament since the 2008 French Open. He's spoken openly about focusing more on enjoying the nightlife than perfecting his craft, and drew attention last week for saying he wouldn't encourage his younger sisters to pursue professional tennis because, ''A woman needs to enjoy life a little bit more. Needs to think about family, needs to think about kids.''
In the concluding set, Gulbis needed only 10 minutes to race to a 3-0 lead, thanks in part to Federer miscues. In the second game, Federer netted backhands and forehands to offer up break points, then pushed a forehand wide to give Gulbis a lead he never relinquished.
After that miss, Federer grabbed a ball and swatted it in anger straight up in the air, a rare sign of exasperation from him.
The result fit with the topsy-turvy nature of this tournament: Both reigning Australian Open champions, No. 3 Stan Wawrinka and No. 2 Li Na, lost in the first round; No. 1 Serena Williams left in the second round.
Gulbis now plays No. 6 Tomas Berdych, who eliminated the last American man, No. 10 John Isner. In another fourth-round match, No. 8 Milos Raonic of Canada beat 39th-ranked Marcel Granollers of Spain 6-3, 6-3, 6-3.
Wimbledon champion Andy Murray and No. 24 Fernando Verdasco set up a fourth-round meeting by finishing off victories in matches suspended Saturday night because of fading light.
In women's action, No. 18 Eugenie Bouchard of Canada swept No. 8 Angelique Kerber of Germany 6-1, 6-2 and will face No. 14 Carla Suarez Navarro of Spain in the quarterfinals.