Updated

Former cricket star Imran Khan declared victory Thursday in Pakistan's parliamentary election that was marred by violence and allegations of fraud, and he pledged to fight corruption and build a nation that bowed to no one.

Khan, who aspires to be the next prime minister, said in a televised address that he wanted good ties with his neighbors, including rival India, and would seek a more equal relationship with the United States.

"Today in front of you, in front of the people of Pakistan, I pledge I will run Pakistan in such a way as it has never before been run," Khan said in the speech, vowing to wipe out corruption, strengthen institutions he called dysfunctional and regain national pride by developing international relationships based on respect and equality.

Pakistan's election commission has not yet released final results from Wednesday's vote, but Khan has maintained a commanding lead, according to projections from many TV stations. It's still unclear if his Tehreek-e-Insaf party, or PTI, would get a simple majority or have to form a coalition government. Election officials said an official count was expected later Thursday.

Khan said the elections were the most transparent and promised to investigate every complaint of irregularity that his opponents presented.

"It is thanks to God (that) we won and we were successful," said the 65-year-old former playboy.

While Khan's appeared casual and conciliatory in his speech, his words were laced with passion. He said the United States treats Pakistan like a mercenary, giving it billions of dollars to fight its war on terrorism.

"Unfortunately, so far our relations were one-sided. America thinks that it gives Pakistan money to fight for them. Because of this Pakistan suffered a lot," said Khan, who has been critical of the U.S.-led conflict in neighboring Afghanistan.

He offered nothing to suggest an improvement in Pakistan's already testy relationship with Washington since President Donald Trump's tweets in January that accused Islamabad of taking U.S. aid and returning only lies and deceit.

Khan focused on what he wanted to do for the poor in Pakistan and his vision of a country that bowed to no one, where everyone was equal under the law and taxes were paid by the rich to fund services for the less fortunate.

His campaign message of a new Pakistan resonated with young voters in a country where 64 percent of its 200 million people are under 30.

More than a dozen TV channels, based on partial returns, projected that the PTI would win as many as 119 seats of the 270 National Assembly seats that were contested, although the broadcasters did not disclose their methodology. The rest of the 342-seat parliament includes seats reserved for women and minorities. Voting for two seats was postponed after one candidate died during the campaign and another was disqualified.

Even if Khan's party wins a simple majority, he would need to wait until the president convenes the parliament to swear in the new lawmakers — traditionally within a week. He also faces an opposition that is challenging the election results, alleging vote-rigging.

His leading rival, Shahbaz Sharif, was one political leader who rejected the outcome. Sharif heads the Pakistan Muslim League, the party of his older brother, former Prime Minister Nawaz Sharif, who is in prison on corruption charges. TV projections give his party barely 61 seats.

The younger Sharif tweeted that "our democratic process has been pushed back by decades," adding that "had the public mandate been delivered in a fair manner, we would have accepted it happily."

Complaints also emerged from the independent Human Rights Commission, which issued a statement saying that women were not allowed to vote in some areas.

In other areas, it said, "polling staff appeared to be biased toward a certain party," without elaborating. In the days before the election, leading rights activist I.A. Rehman called the campaign "the dirtiest" in Pakistan's bumpy journey toward sustained democracy.

Analysts have expressed concern that disgruntled losers could create instability for the incoming government, which must deal with a crumbling economy, crippling debt and a raging militancy.

The voting was marred by a suicide bombing in the southwestern city of Quetta, the Baluchistan provincial capital, that killed 31 people as they waited to vote. A bombing in the same province earlier this month killed 149 people, including a candidate for office. Baluchistan has been roiled by relentless attacks, both by the province's secessionists and Sunni militants who have killed hundreds of Shiites there.

The election marked only the second time in Pakistan's 71-year history that one civilian government has handed power to another.

There were widespread concerns during the campaign about manipulation by the military, which has directly or indirectly ruled Pakistan for most of its existence. The military had deployed 350,000 troops at the 85,000 polling stations.

In a tweet, Pakistan's military spokesman Gen. Asif Ghafoor called allegations of interference "malicious propaganda."

___

Associated Press Writer Zarar Khan in Islamabad contributed to this report.