President Obama on Friday announced the end of a 22-year ban on travel to the United States by people who had tested positive for the virus that causes AIDS, fulfilling a promise he made to gay advocates and acting to eliminate a restriction he said was “rooted in fear rather than fact.”

At a White House ceremony, Mr. Obama announced that a rule canceling the ban would be published on Monday and would take effect after a routine 60-day waiting period. The president had promised to end the ban before the end of the year.

“If we want to be a global leader in combating H.I.V./AIDS, we need to act like it,” Mr. Obama said. “Now, we talk about reducing the stigma of this disease, yet we’ve treated a visitor living with it as a threat.”

The United States is one of only about a dozen countries that bar people who have H.I.V., the virus that causes AIDS.