The government has allowed animal testing for makeup ingredients to resume despite a 25-year ban.
It changed a policy on animal testing to align with EU chemical rules, according to a High Court ruling.
The High Court said on Friday that the government was acting legally after a case was brought by animal rights activists.
More than 80 brands have said they are "dismayed" by the government's new position.
A Home Office spokesperson told the BBC: "We are pleased that the High Court has agreed with the Government's position in this case. The government is committed to the protection of animals in science".
Animal testing for makeup or its ingredients had been completely banned in the UK since 1998. Animal testing had only been allowed if the benefits gained from the research outweighed any animal suffering, for example for medicines.
But in 2020 the European Chemicals Agency (ECHA), an EU agency which oversees chemical regulation, ruled that companies needed to test some ingredients used in cosmetics on animals to ensure they were safe for workers manufacturing the ingredients.
During the case it was revealed that since 2019 the government had been issuing licences for animal testing of cosmetic ingredients in line with EU chemical rules, which it retained despite leaving the EU in 2020.
This could include testing chemicals commonly found in foundations and concealers by forcing rats to inhale or ingest them.
It is not known how many such licenses were issued or to whom.
Cruelty Free International (CFI), which brought the case, argued this was illegal and in breach of the animal testing ban for makeup and its ingredients, which has stood since 1998.
Mr Justice Linden ruled in favour of the government, saying that the change in policy still met existing laws, although he said it was "regrettable" the public had not been informed.
The change in the government's position has been heavily criticised by major beauty and cosmetic brands, including Unilever, Body Shop and Boots. Most major brands have long campaigned to end animal testing.
Cruelty Free International said it was "outrageous" that the government had effectively lifted the ban.
Christopher Davis, director of activism and sustainability at the Body Shop said they would "campaign vigorously" against the changes.
"Allowing animal testing for cosmetics would be a devastating blow to the millions of people who have supported campaigns to end this appalling practice," he told the BBC after the ruling.
The ingredients that may be tested on animals include homosalate - a common sunscreen ingredient used already in many foundations and skincare products.
In low doses homosalate is safe but in higher concentrations the evidence for its impact on the human immune system are inconclusive.
Manufacturers can now apply for licenses to undertake animal testing before production begins, to ensure the safety of workers. But they still cannot undertake any animal testing to check the safety of the makeup for consumers. This should be done using other methods.
Mr Justice Linden said that nothing was stopping the government from introducing an absolute ban on animal testing of makeup products if it desired.
Cruelty Free International CEO Michelle Thew said: "The case shows clearly that [the government] was prioritising the interests of contract-testing companies over those of animals and the wishes of the vast majority of British people who are strongly opposed to cosmetics testing."
CFI said it would appeal the decision made by the court and ask the government to reinstate the complete ban in the UK.
Dr Julia Fentem, head of the safety and environmental assurance centre at Unilever - one of the world's largest cosmetic companies - said tests potentially required under the new policy were "unnecessary", and that safety tests could be carried out without animal involvement.
A new chemicals strategy is expected to be published this year outlining the government's position on the use and testing of chemicals in the UK - which may include further guidance to cosmetic companies.