XAPURI, Brazil (Reuters) - Brazil's government will hand out 9 million condoms for free around Rio de Janeiro during the Olympics in August, a push meant to encourage safe sex and also defend the Amazon rainforest.

Rio's local Olympic organizing committee said about 450,000 of the sustainably-produced condoms will be destined for athletes and staff housed in the Olympic Village.

The rest will be made widely available to the many visitors who will be arriving in the city in just a few weeks, the Health Ministry said.

All the condoms to be distributed are produced by Natex, a factory in the western Amazonian state of Acre, deep in the rainforest near Brazil's border with Bolivia.

The factory, run by the Acre state government, uses latex gathered from Amazon rubber trees by tappers who are employed by a government-run program designed to protect their traditional livelihood, foster sustainable use of the rainforest and deter illegal loggers.

The tappers see themselves as guardians of the rainforest.

On a recent outing, Raimundo Mendes de Barros, a 71-year-old lifelong rubber tapper with a stark white beard, gathered the milky-white latex dripping into metal buckets hooked at the base of countless trees. Above, the tropical sun was filtered by the Amazon canopy.

Barros spoke with pride about the fierce fight he and other sustainable rubber tappers wage to maintain their craft.

"Our condom factory, aside from guaranteeing a fair price for the rubber, employs hundreds," he said. "It gives the world a product - the condom - that will be very present there in Rio, to fight disease and help with birth control."

For decades, tappers like Barros have been on the front line of pushing Brazilian leaders to do more to halt deforestation, which is mostly caused by the illegal clearing of forest for ranching, soy farms and timber extraction.

The fight has sometimes come at a heavy cost as farmers and loggers have sometimes retaliated with hired guns. Scores of people have been killed over the years trying to protect the forest, most notably the internationally known environmentalist and rubber tapper Chico Mendes.

His 1988 murder in Xapuri, where the condom factory now stands, helped galvanize the government to take serious measures to battle deforestation and the violence against Amazon defenders.

For several years Brazil's Health Ministry has distributed millions of condoms from the factory for free at big events around Brazil - most notably the annual bacchanal of Carnival.

(Reporting by Ricardo Moraes; Writing by Brad Brooks; Editing by Frances Kerry)