Japanese gas company Iwatani Corp has agreed to buy a stake of about 20% in Cosmo Energy Holdings from a group of activist investors, though it was not clear if the country's third-biggest oil refiner had found itself a white knight.

Iwatani will pay ¥105.3 billion ($710.8 million), or ¥6,052 per share, to raise its stake in Cosmo to 19.93% from the current 0.07%, and will buy an additional 0.29% subject to regulatory approval, according to an exchange disclosure.

The share acquisition marks an end to Cosmo's high-profile battle with a group led by prominent activist shareholder Yoshiaki Murakami, which had flagged its intention to raise its stake from 20% to nearly 25%.