KAMPALA, UGANDA -- Ugandan presidential challenger Bobi Wine has emerged from last week's disputed election as the country's most powerful opposition leader after his party won the most seats of any opposition group in the national assembly.

It's a major achievement for a party that's barely six months old and almost didn't make it on the ballot when it was accused by government officials of being an illegal entity. While longtime President Yoweri Museveni has been declared the winner of a sixth term, the rise of the 38-year-old Wine's party marks a generational shift.

"We set out to see change of leadership at all levels. We have not achieved the ultimate, but we are still on course. It's like felling a tree. You keep cutting, chipping away until the tree falls," said Joel Ssenyonyi, spokesman for Wine's National Unity Platform.

Removing Museveni through voting, he added, "is not easy, but it's not impossible."

Wine, a singer-turned-lawmaker whose real name is Kyagulanyi Ssentamu, now will decide who leads the opposition in Uganda's legislature after his party won at least 56 seats. That number could rise to 61 when final results are announced. But the ruling National Resistance Movement party still has over 300 seats, an absolute majority that means Museveni can move ahead with his agenda without negotiating with the opposition.

Wine's party, however, also will lead the influential oversight committees that long were dominated by an opposition group led by Kizza Besigye, who sat out this election amid Wine's meteoric rise.

"He has managed to write something new," Nicholas Sengoba, an analyst and newspaper columnist, said of Wine. "He has put a dent in the Museveni establishment. He has dented the narrative in Uganda that to be a national leader you must have a military background."

Museveni, a former guerilla leader who has held office since 1986, faced arguably his greatest election challenge yet from Wine. The 76-year-old president was able to run for another term, allowing him to extend his rule to four decades, after lawmakers in 2017 removed the last constitutional obstacle -- age limits -- to a possible life presidency.

For decades a U.S. ally on regional security, Museveni now finds himself increasingly at odds with an outside world he sees as hellbent on regime change. Wine has urged the international community, including the United States, to suspend the billions of dollars in foreign aid that he says props up a brutal regime.

Museveni, in response, has called Wine a foreign agent and says he will not tolerate interference from the international partners whose money helps his government provide important public services.

"The Bazungu. I don't want to be racist, but they are the ones who are mostly involved" in meddling, Museveni said in a televised address on Saturday after he was declared the election winner, using a Swahili word for white people. "Foreign meddling will not be tolerated."

On Monday, the U.S. ambassador to Uganda was blocked by security forces from visiting Wine at his home, which is surrounded by soldiers. Wine tweeted on Tuesday that his family is "stuck" with his wife's 18-month-old niece whose father has been denied access to the home. "We have run out of food and milk," Wine said.

Police, who insist the deployment is to prevent Wine's presence in the public from inspiring riots, said they had made arrangements for Wine to meet with associates and lawyers but Wine "refused to meet with them and offered to do so at a later stage."

Museveni won Thursday's election with 58% of the vote while Wine had 34%, according to official results. That's Museveni's lowest share of the vote since his government first organized elections in 1996, when he won 75%.

Many members of Museveni's government, including the vice-president, lost or failed to win parliamentary seats. Many of the losses were to candidates from Wine's party, which swept the central region that includes the capital, Kampala, as well as an enclave that once was the launchpad of the war that brought Museveni to power.

"If you have lost your mecca, then what next?" Adrian Jjuuko, an analyst who runs a local rights watchdog, told local broadcaster NTV, referring to Museveni's loss in Luweero district.

Wine insists he won the election and says he will prove allegations the military was stuffing ballot boxes, casting ballots for people and chasing voters away from polling stations.

"I know many of you were brutalized for trying to record evidence of rigging, but those who succeeded, please send in the videos," Wine said on Tuesday.

Museveni has dismissed allegations of vote-rigging. "I think this may turn out to be the most cheating-free election since 1962," when Uganda won independence from Britain, he said in his national address.

Wine, who is effectively under house arrest, can challenge the election results in Uganda's highest court. But judges in the past have been reluctant to rule against Museveni.

A presidential candidate must launch any legal challenge to election results within 10 days of the declaration of final results. Medard Sseggona, an attorney for Wine, said in the meantime the party has filed a petition with the High Court seeking an injunction against Wine's house arrest as well as an order to free him.

Authorities continue to face questions about the authenticity of the election results, especially after the electoral commission on Monday acknowledged an account in the local media that results from over 1,000 polling stations had not been counted.

The commission concluded that the vote difference between Museveni and his closest challenger, Wine, "would not be overturned by votes from the remaining 1,223 polling stations," it said.

The commission did not say how many uncounted ballots were affected. The Daily Monitor newspaper had reported that the vote-rich central district of Wakiso, widely seen as Wine's stronghold, was the most affected.

The election was marred by violence ahead of polling day, with Wine and other opposition candidates detained and harassed, as well as an internet shutdown that remained in force until Monday, when access was restored for most Ugandans. Social media sites remain restricted.

The International Crisis Group, in an analysis, predicted trouble ahead for Museveni. "Many young people see Museveni as the face of an out-of-touch gerontocracy unable to meet the needs of the country's masses of unemployed," said the group's Murithi Mutiga.