EBay and PayPal's divorce just got messier.

EBay (EBAY), one of the world's biggest online marketplaces, announced Wednesday that it's dropping PayPal as its main partner for processing payments in favor of Dutch company Adyen.

The news prompted investors to offload PayPal (PYPL) stock, which fell more than 11% in after-hours trading.

The two U.S. tech companies have a complicated history.

In 2002, eBay paid $1.5 billion to buy PayPal, an online payments company whose founders include Silicon Valley heavyweights Elon Musk and Peter Thiel.

It proved to be a very successful investment. When eBay spun off PayPal in 2015 -- something investors and analysts had urged it to do -- the payments company's market value was close to $50 billion. It's now above $100 billion.

Related: PayPal introduces a new cash back credit card

Despite the split, the two companies' businesses have remained tightly linked. PayPal continued to process payments for eBay and is the preferred payment method for most of the buyers and sellers on the site.

But eBay is now moving to cut those ties. The ecommerce company plans to take more direct control of payments on its site with help from Adyen.

EBay said the benefits of the changes would include lower costs for sellers and more payment options for buyers.

The shift will start gradually in North America later this year and eBay expects most marketplace customers around the world to be using the new system in 2021.

PayPal spokeswoman Amanda Miller said the company will "continue to provide a comprehensive payments solution to eBay through July 2020." It will also remain a payment option at checkout for eBay customers until July 2023.

Related: Amazon's bigger rival in India is bulking up

PayPal's business with eBay is big and still growing: it was up 10% in the fourth quarter of 2017. But that's slower growth than other parts of PayPal's operations, which means that eBay makes up a decreasing portion of the tens of billions of dollars of payments the company processes.

EBay accounted for 13% of the payments PayPal handled in the fourth quarter, down from 16% in the same period a year earlier, PayPal said.

Adyen said it's "thrilled" to be getting its hands on the eBay payments business.

"We look forward to powering transactions on eBay, starting in North America, and supporting their continued global growth," the Dutch company said in a statement.

Based in Amsterdam, Adyen already works with other big tech companies including Uber and Netflix (NFLX). It says it handles more than 200 different payment methods and over 150 currencies.