When it exited the European union. The entire point of the European Union was to create a unified front against the United States. A single European country cannot stand up to the economic might of America. The European Union was explicitly put in place to deal with that situation so that individual countries couldn't be picked apart by America and controlled.
It's far from the entire point, although it is one of the considerations.
I'm originally from a developed nation outside the EU (Australia) and people in the UK had no idea how much power the EU gave them vis a vis with the United States, not just the US but everyone really. A trading bloc of 400 million gives you a lot of leverage. The UK is still learning the hard way that on it's own, we're nowhere near that powerful. One of the reasons we're not learning is that the US is not leaning on the UK like it does other countries like Australia (the US is having it's own problems, like a mad leader committed to the downfall of it's hegemony).
The EU was about not just trade (prosperity) but ensuring peace within it's members. Part of peace is human rights which the EU cares quite strongly about. In fact the openness on trade is somewhat more loosely enforced with members regularly skirting or even flat out ignoring the rules. France famously refused to import British beef, I believe they are also turning their nose up at Irish beef too, and I'm not just picking on France, the UK abused the system too, the EU largely ignored it as the system was by and large working as designed and it understands that you pick your battles. Let the little stuff go so you can take care of the big shit that goes wrong.