Ugandan lawmakers on Tuesday passed a bill criminalizing the "willful and intentional" transmission of HIV.
The bill imposes jail sentences of up to 10 years for those found guilty and also requires pregnant women and their partners to get tested for the virus.
Parliamentarian Peter Aleper told local television last week that people who knowingly transmit HIV are dangerous to others.
"Every punishment should be given because this person is aware that he or she is infected, and goes ahead intentionally to transmit to another person," Aleper said. "That's a very dangerous person that can easily confuse the whole community and finish people."
But health workers and civil society groups have spoken out against the bill, saying it will do nothing to curb Uganda's rising infection rate. Many argue the bill will further stigmatize people who are HIV positive.
According to Margaret Happy of the National Forum of People Living With HIV AIDS Networks in Uganda, the risk of criminalization is likely keep people from getting tested.
"It instills fear in both women and men, because many people will not go for HIV testing. Because if one goes for HIV testing ... he or she would be caught up by this bill," she said. "And yet HIV testing is an entry point to accessing other HIV prevention services."
The legislation follows Uganda's recent enactment of a tough new law that imposes life sentences in prison for committing some homosexual acts.
In recent years, a number of other African countries have passed laws against transmitting HIV, including Kenya, Tanzania and Zimbabwe. Other countries, and some American states, also have such laws. Other countries, including some European nations, have prosecuted people for transmitting HIV under different laws against harming others.
The Ugandan bill needs President Yoweri Museveni's signature to become law.