Foxconn, the world’s largest contract electronics maker, reached a consensus with Japan’s Sharp Corp. on most points related to its proposed $5.9 billion takeover, according to Foxconn CEO Terry Gou.

The two companies cleared 90 percent of the hurdles toward a deal but fell short of a final agreement because of an unspecified legal issue, Gou reportedly said after meeting Sharp executives at the company’s headquarters in Osaka.

“I wanted to show you the signed final agreement document,” Gou told reporters, according to the Wall Street Journal. “I see no further big obstacles,” he added.

However, in a statement issued Friday, Sharp reportedly did not divulge any details, simply saying that both the companies remained in talks.

Foxconn, formally known as Hon Hai Precision Industry Co., was caught in a protracted takeover battle with Japanese government-backed fund Innovation Network Corp. of Japan (INCJ) over Sharp since last year.

Sharp was leaning towards INCJ’s comparatively lower offer till last week in order to keep its technology in Japanese hands, the Nikkei Asian Review reported earlier. However, the troubled Japanese electronics maker signaled its preference for Foxconn’s offer Friday, giving it preferred negotiating rights.

“More [negotiating] resources are being put toward Hon Hai than toward the rival plan from the Innovation Network Corp. of Japan,” Sharp President Kozo Takahashi reportedly told a news conference after the meeting with Foxconn.

Shares in Sharp soared 25.7 percent in two days on the Tokyo Stock Exchange, gaining 10 percent Friday, on the news that Gou had flown in to meet Sharp executives.