The Supreme Court on Friday approved the online sales of over-the-counter drugs, ruling in favor of two online retailers that argued that a government ordinance banning such sales is excessive and illegal.

The top court turned down an appeal from the government against a Tokyo High Court ruling in 2012 that repealed an earlier lower court rejection of suits filed by Kenko.com Inc., a Tokyo-based online store selling health products, and Wellnet, a Yokohama-based firm that sells heath products, cosmetics and drugs on Rakuten Ichiba, the country's biggest online shopping mall.

The Supreme Court's four-justice Second Petty Bench unanimously ruled that the ordinance issued by the Health, Labor and Welfare Ministry is "illegal and invalid," noting that such an across-the-board ban on online sale of drugs violates the Pharmaceutical Affairs Law.