Lowe's has tapped JCPenney CEO Marvin Ellison as its new chief executive.

Ellison had been trying to lead a turnaround at JCPenney, but that has not been going well recently. It lost $69 million in the most recent quarter.

JCPenney will replace Ellison with an "office of the CEO" in which four executives will share responsibility for running the company while it conducts a search for a new CEO.

Shares of JCPenney (JCP) sank as much as 9% in morning trading, hitting a record low, though it came off that low later in the day. Shares of Lowe's (LOW) was initially slightly higher on the news before turning lower.

Ellison is currently one of only three black CEOs leading a Fortune 500 company. He came to JCPenney in 2014 after a 12-year career at Lowe's rival Home Depot (HD), eventually serving as executive vice president of that chain's US stores. He had worked at Target (TGT) for 15 years before that.

"Attracting Marvin is a great win for the entire Lowe's team," said Marshall Larsen, lead director of the Lowe's board.

Related: Why JCPenney is in serious trouble

At first it appeared that Ellison had succeeded in turning around JCPenney. It reported a strong holiday season for 2015, a year after he took the top job there and predicted the improved sales would continue. But soon the losses returned.

Ellison will start at Lowe's on July 2, replacing retiring CEO Richard Niblock. Unlike Niblock, he will not be chairman -- the company named director Richard Dreiling to that post.

Lowe's has been under pressure too. Although it has been profitable its stock has trailed Home Depot's performance over the last two years. Home Depot's stock has risen 42% over that period, but Lowe's shares are up only 9%.

Under pressure from an activist investor, Lowe's recently named three new members to the board.