Frederick William, Elector of Brandenburg, called "The Great Elector," (1620-88) was the first great man of the Hohenzollern family. Becoming Elector in 1640, he devoted his early years to repairing the ravages caused by the Thirty Years' War. By the Peace of Westphalia (1648) he lost part of his dominions, but in 1657 he secured the freedom of the duchy of Prussia from Poland. During the years 1672-79 he was engaged in a war with France and Sweden, and, though he drove the latter from Brandenburg, he was deserted by his allies, and obliged to pay an indemnity to Louis XIV. Nevertheless, at his death he left Brandenburg in the position of second German state, with a small but highly-efficient army, sound finances and the germs of trade. He revenged himself on France by receiving 20,000 refugees, who left her after the revocation of the Edict of Nantes, and who brought with them their industrial skill. He encouraged agriculture, opened canals, and set on foot a postal system. The royal library at Berlin was his foundation, and the capital of Prussia owes much to him besides. In religious matters he was tolerant. To sum him up, he was an earlier type of Frederick the Great.