For the first time, a study shows that a drug used to treat HIV infection also can help prevent it when taken before and after risky sex by gay men.

The results offer hope of a more appealing way to help prevent the disease beyond taking daily pills and using condoms, although those methods are still considered best.

The study, done in France and Canada, is the first to test "on demand" use of Truvada, a pill combining two AIDS drugs, by people planning to have risky sex. The uninfected men who took it were 86 percent less likely to get HIV compared to men given dummy pills.

"That impressed me," Dr. Scott Hammer said of the size of the benefit. He is an AIDS specialist at Columbia University in New York and heads the Retrovirus Conference going on in Seattle, where the results were discussed Tuesday.

Daily Truvada pills are used now to prevent HIV infection in people at high risk for it, and studies show the drug helps even when some doses are skipped. Health officials have been leery of billing it as a "chemical condom" out of fear that people will not use the best prevention methods, but many won't use condoms all the time or take daily pills.

The study of Gilead Science's Truvada was led by the French national HIV research agency.

Men were given fake or real Truvada and told to take two pills from two to 24 hours before sex, a third pill 24 hours later, and a fourth pill 48 hours after the first dose. The men also were given condoms and disease prevention counseling.

The study was stopped early, in November, after 400 men were enrolled and researchers saw that the drug was working; there were two new HIV infections among those on Truvada and 14 in those on dummy pills. The two infections in the Truvada group were in men who stopped using the pills after more than a year in the study.

The drug was safe, but nausea and diarrhea were more frequent among men who used it. Only one stopped using it because of side effects.

Dr. Susan Buchbinder, an AIDS specialist at the San Francisco Department of Public Health, called the results exciting but warned that it can't be assumed they would apply to male-female sex, because different types of sex expose partners to differing amounts of virus.

The U.S. Centers for Disease Control and Prevention still recommends daily Truvada pills for prevention, and many men in the French study ended up taking them nearly that often because of how frequently they had sex, said the CDC's HIV prevention chief, Dr. Jonathan Mermin.

"We need all the options we can get" for preventing HIV infection, Mermin said. "People choose different prevention methods. What we want is for them to choose effective ones and to use them regularly."

One advocate for wider use of prevention pills - Damon Jacobs, a New York City psychotherapist - agreed.

For years, the public health message was "condoms only, condoms only, condoms only," he said in a speech at the conference. "People are having sex for pleasure" and need alternate ways to reduce their risk, Jacobs said.

A second study presented at the conference by the U.K. Medical Research Council found that daily use of Truvada cut the risk of infection by 86 percent in a "real world" test of gay men aware they were taking Truvada for HIV prevention.

Researchers assigned 545 gay men to get Truvada right away or a year later. The study was stopped in October after HIV infections occurred in only three men given Truvada but in 19 of those assigned to get it after a year.

As in the French study, rates of other sexually spread diseases were similar in both groups, leading researchers to conclude that use of the prevention pills was not increasing risky behavior.