<P> In 1807, the king of Castile and his French allies invaded Portugal, using a route that crossed through Spanish territory . However, the French decided to take over both countries, overthrowing the King of Castile and forcing the Portuguese royal family to escape to the Portuguese colony of Brazil . Spain and Portugal subsequently became allies for the first time in centuries and, allied to a British army under Sir Arthur Wellesley, drove the French back across the border in 1813 after a prolonged, brutal conflict known as the Peninsular War . </P> <P> After the fall of Napoleon, both countries came close to war a number of times during the early 19th century . Both lost their American colonies shortly after the end of the Peninsular War, which severely weakened their global power . </P> <P> The 1930s saw similar right - leaning, authoritarian and nationalist regimes emerge in both countries . In Portugal, António de Oliveira Salazar established his Estado Novo in 1933 . In 1936, Francisco Franco launched a rebellion against the Spanish government, and after three years of civil war, his nationalists were triumphant . </P> <P> Both states remained neutral in World War II, though Spain was more predisposed to Nazi Germany, Portugal also maintained a friendly relationship with Nazi Germany, supplying it with many key resources such as tungsten . Yet in virtue of the 14th century alliance Portugal had with England, it was also supplying Britain with all sorts of produce, and whilst the Germans had to pay immediately, Britain had an open account for most of the war . </P>

Why is portugal a separate country from spain