Top Indian drug giant Sun Pharmaceutical Industries said Monday it had agreed to buy its troubled peer Ranbaxy for $4.0 billion in stock, ending its ill-fated six-year control by Japan's Daiichi Sankyo. The deal will create India's biggest drugs manufacturer by far and leave Daiichi Sankyo with a significant stake in the combined entity. The United States, one of Ranbaxy Laboratories' biggest markets, has slapped import bans on Ranbaxy's manufacturing plants for failing to meet "good manufacturing practices". Daiichi Sankyo bought Ranbaxy in 2008, believing its dominance in cheap generic medicines and developing markets would help the firm grow. But the Indian company has been a weight on Daiichi's books ever since due to its regulatory problems. Under the acquisition terms, Ranbaxy shareholders will receive 0.8 shares of Sun Pharma for each of their own shares, worth the equivalent of 457 rupees ($7.60). US regulators also banned some products by Sun Pharmaceuticals last month as the US Food and Drug Administration scales up scrutiny of India's $14-billion-a-year pharmaceutical sector amid worries about safety. India, known as "pharmacy to the world" due to its vast generics market, supplies medicines to more than 200 countries -- many in the emerging world -- and is the second largest supplier of drugs to the United States after Canada.