By Nick Rankin
BBC News, Costa Rica
Costa Rica has a history of fighting off foreign political influences, but although proud of its independence it is also aware of not upsetting its northern and southern neighbours.
Parades are part of the celebrations for national hero Juan Santamaria
They used to call Alajuela, the second biggest town in Costa Rica's warm central valley, Villa Hermosa, or "pretty city".
Any Sunday morning in the main square will show you why.
It is laid out in the usual Spanish colonial style, the centre of a grid of streets where civic powers meet. But the cathedral, the town hall and the bank look down not on some barren plaza, but on a lively ornamental park.
Costa Rica is rich in plant and bird life, all nurtured by fertile volcanic soils, and the Parque Central de Alajuela is loud with squawking parrots and pigeons splashing in the rococo fountain, under palm trees which zoom like frozen fireworks into the blue sky.
And at 10am every Sunday, on the back echo of the cathedral clock, a conductor taps his baton on the music stand, and the municipal orchestra strikes up its first selection from the great canon of European and American brass band music.
But the opening piece that week was Rossini's overture to William Tell. This became the theme tune to The Lone Ranger, on TV but it is from an opera about a small country's patriotic resistance to foreign tyranny.
It was appropriate here because Alajuela is the home-town of Costa Rica's national hero, Juan Santamaria, who died 150 years ago.
There is a museum dedicated to him, just a block away from the Parque Central. I asked a school girl who Juan Santamaria was. "He's the drummer boy who expelled the filibusters [pirates]" she said instantly.
"He carried the torch that drove out the American invaders."
She was referring to a crucial incident in the thwarting of William Walker, a fanatical US adventurer who landed in Nicaragua with an army of mercenaries in 1855, declared himself president and set about conquering all Central America with a view to instituting slavery and building a ship canal.
Among the improvised civilian militias who opposed him was Juan Santamaria, a poor lad who looked after his widowed mother.
Walker's mercenaries were holed up in a town called Rivas in a building with a thatched roof, and the only way to get them out was to set it on fire.
Two other men were shot down before Juan Santamaria managed to set the roof ablaze. He died the next day, of a combination of wounds and fever but the smoked-out Walker ended up before a firing-squad in Trujillo, Honduras in 1860.
A century and a half on, visitors to Costa Rica are likely to be holding the Lonely Planet travel guide and be looking for a good cup of coffee and an internet connection.
People realised that Costa Rica had an ecological and biological diversity that was worth more alive than dead.
And they will probably find both and be welcomed.
Costa Rica's number one earner is now tourism, overtaking coffee and bananas, melons and meat.
Time was when Costa Rica was famous for cutting down its forests for cattle ranches to make hamburgers for the US. But then people realised that Costa Rica had an ecological and biological diversity that was worth more alive than dead.
Visitors will pay to see the life of wet and dry tropical forest, rain forest, cloud forest. They want to surf in warm seas and ride horses and watch an active volcano from a Jacuzzi. Ornithologists and twitchers will pay a lot for what one guide, in his mangled English, described as "bird-squashing".
Thus over a quarter of the country is now protected in reserves and national parks, and they market the country under the slogan "Pure Life".
It is going to be the last country in the isthmus to sign Cafta, the Central America Free Trade Agreement, which opens up all markets to the superpower in the north.
The chill wind of economic liberalism may upset some cosily corrupt arrangements, especially among the trade unions, but President Oscar Arias argues that his small trading country cannot afford not to sign. This then will please Washington DC.
But other countries in South America see free trade as just another name for Yanqui imperialism.
Thus Cuba, Venezuela and Bolivia recently formed a People's Union to share food and doctors and energy. Hugo Chavez, the ex-military populist who runs oil-rich Venezuela was invited to Oscar Arias's inauguration but did not make it.
Costa Rica would love to get a deal on cheaper petrol, however.
Arias's new cabinet, which includes five women, is said to have more PhDs in it than any governing body in the Americas. They are smart enough to keep lines open to both north and south.
Like Alajuela's fine musicians they can play rancheras and sambas as well as the theme tune of "The Lone Ranger".
From Our Own Correspondent was broadcast on Saturday, 20 May, 2006 at 1100 BST on BBC Radio 4. Please check the programme schedules for World Service transmission times.