A South Korean Go grandmaster on Sunday scored his first win over a Google-developed supercomputer, in a surprise victory after three humiliating defeats in a high-profile showdown between man and machine.

Lee Se-Dol thrashed AlphaGo after a nail-biting match that lasted for nearly five hours — the fourth of the best-of-five series in which the computer clinched a 3-0 victory on Saturday.

Lee struggled in the early phase of the fourth match but gained a lead towards the end, eventually prompting AlphaGo to resign.

Google AI Beats Grandmaster in First 'Go' Showdown

The 33-year-old is one of the greatest players in modern history of the ancient board game, with 18 international titles to his name — the second most in the world.

“I couldn’t be happier today…this victory is priceless. I wouldn’t trade it for the world,” a smiling Lee said after the match to cheers and applause from the audience.

“I can’t say I wasn’t hurt by the past three defeats…but I still enjoyed every moment of playing so it really didn’t damage me greatly,” he said.

'Ex Machina': Science Vs. Fiction

Lee earlier predicted a landslide victory over Artificial Intelligence (AI) but was later forced to concede that the AlphaGo was “too strong”.

Lee had vowed to try his best to win at least one game after his second defeat.

Described as the “match of the century” by local media, the game was closely watched by tens of millions of Go fans mostly in East Asia as well as AI scientists.

A.I. Slam Dunks Impossible Game Of 'Go'

The most famous AI victory to date came in 1997, when the IBM-developed supercomputer Deep Blue beat the then-world class chess champion Garry Kasparov.

But Go, played for centuries mostly in Korea, Japan and China, had long remained the holy grail for AI developers due to its complexity and near-infinite number of potential configurations.

- ‘More creative than we imagined’ -

Demis Hassabis, the head of the AlphaGo developer Google DeepMind, has described Go as the “Mount Everest” for AI scientists.

“Lee Se-Dol was an incredible player and was too strong for AlphaGo,” Hassabis said after Sunday’s match.

“It was doing well…but then, because of Lee’s fantastic play, it was pressurised into some mistakes,” he said, describing the loss as a “valuable” way to fix the problems with the supercomputer.

“Actually we are very happy because this is why we came here, to test AlphaGo and its limit and find out what its weaknesses were,” he said.

Lee said those weaknesses included a difficulty in responding to certain unexpected plays by an opponent, which led to more mistakes.

Go involves two players alternately laying black and white stones on a chequerboard-like grid of 19 lines by 19 lines. The winner is the player who manages to seal off more territory.

On the 78th move, Lee placed a stone unexpectedly in the middle section of the board, stunning many experts and confusing the AlphaGo.

Hassabis later tweeted that the AlphaGo made a “mistake” on the following 79th move and only realized it several moves later.

AI Twitterbot Sounds A Lot Like Trump

AlphaGo uses two sets of “deep neural networks” that allow it to crunch data in a more human-like fashion — dumping millions of potential moves that human players would instinctively know were pointless.

It also employs algorithms that allow it to learn and improve from matchplay experience.

“I think AlphaGo is far more creative than we ever imagined. It makes us to rethink all the conventional rules and knowledge we learned in Go,” said Lee Hyun-Wook, a TV commentator and professional Go player.

The last match is to be held on Tuesday in the Four Seasons Hotel in Seoul.