British national security depended on the balance of power in continental Europe. Britain's consistent and explicit objective was to maintain this balance. Whenever any single power threatened to dominate Europe - Spain under the Hapsburgs, France under Louis XIV and Napoleon, Germany under Wilhelm II and Hitler - an opposing alliance would form against it, and Britain would always back that alliance.
The American policymaker George Kennan, writing in 1951, describes the basic rationale:
Today, standing at the end rather than the beginning of this half-century, some of us see certain fundamental elements on which we suspect that American security has rested. We can see that our security has been dependent throughout much of our history on the position of Britain; that Canada, in particular, has been a useful and indispensable hostage to good relations between our country and British Empire; and that Britain's position, in turn, has depended on the maintenance of a balance of power on the European Continent. Thus it was essential to us, as it was to Britain, that no single Continental land power should come to dominate the entire Eurasian land mass. Our interest has lain rather in the maintenance of some sort of stable balance among the powers of the interior, in order that none of them should effect the subjugation of the others, conquer the seafaring fringes of the land mass, become a great sea power as well as land power, shatter the position of England, and enter - as in these circumstances it certainly would - on an overseas expansion hostile to ourselves and supported by the immense resources of the interior of Europe and Asia.
Britain was also quite willing to switch sides whenever it looked like one side was becoming too powerful. Hans Morgenthau summarizes:
In 1512, Henry VIII of England made an alliance with the Hapsburgs against France. In 1515, he made an alliance with France against the Hapsburgs. In 1522 and 1542, he joined the Hapsburgs against France. In 1756, Great Britain allied itself with Prussia against the Hapsburgs and France. In 1793, Great Britain, Prussia, and the Hapsburgs were allied against Napoleon. In 1914, Great Britain joined with France and Russia against Austria and Germany, and in 1939 with France and Poland against Germany.
Note that Britain's population was large enough that it needed to import food. Therefore, British superiority at sea was a vital interest, and Wilhelm II's expansion of the Imperial German Navy was regarded as a major threat.
See Paul Kennedy, The Rise and Fall of the Great Powers: Economic Change and Military Conflict from 1500 to 2000.