PHNOM PENH, Cambodia — Cambodian Prime Minister Hun Sen engineered a pardon for his most prominent rival Friday, clearing the way for the self-exiled politician to return home and campaign in this month's general election.

The pardon came after the U.S. and others had said the exclusion of Sam Rainsy from the July 28 vote would call into question the polls' legitimacy. His return is not likely to greatly affect the big picture at the polls, where Hun Sen appears assured of extending his 28-year rule.

Sam Rainsy has lived abroad since 2009 to avoid an 11-year prison term on charges widely seen as politically motivated.

King Norodom Sihamoni pardoned him Friday at Hun Sen's request. The pardon signed by the king, and the prime minister's letter requesting it, were seen by The Associated Press.

Hun Sen's letter requested the pardon "in the spirit of national reconciliation, national unity and to make sure the national election process is conducted under the principal of democracy with freedom and pluralism and jointly by all involved parties."

Yim Sovann, a spokesman for Sam Rainsy's Cambodia National Rescue Party, said the exiled leader would return soon. Some supporters said they expected him back Sunday.

The pardon came shortly after Sam Rainsy declared that he planned to come back before the election, which suggests a deal may have been worked out.

In an emailed statement released by his party, Sam Rainsy thanked the king for his pardon, and said he knew that he had "never done anything wrong."

"I would have returned even in the absence of a pardon to highlight the condition of democracy in my country. My return is no more than a step on a long journey towards achieving self-determination for Cambodia," he wrote.

He also criticized the official election body as unsupportive of democracy and said, "The mere fact of my return does not create a free and fair election for Cambodia."

Hun Sen's Cabinet spokesman Phay Siphan said the pardon had nothing to do with the election or international pressure.

"The prime minister did it for the sake of the country and in the spirit of national reconciliation," he said. "Sam Rainsy is free now; he can come back to Cambodia. We welcome him back."

The pardon would appear to benefit both Sam Rainsy and Hun Sen, longtime bitter rivals.

Though Sam Rainsy is seen as the sole Cambodian politician with the charisma and resources to present any real challenge to the well-entrenched prime minister and his Cambodian People's Party, Hun Sen is still expected to win in a landslide.

Still a return would provide at least a morale boost for Sam Rainsy's party, which has been greatly handicapped by having its leader absent.

"His presence will not make much difference in terms of the election results," said independent political analyst Chea Vannath. "But I can say his presence will reassure voters that he is coming back to stay with them, which will warm the hearts of his supporters."

The opposition was dealt a blow last month when 28 of its lawmakers were expelled from parliament after a committee, run by Hun Sen's party, ruled they had broken the law by running for re-election under the banner of the recently established Cambodia National Rescue Party and not those under which they had won their seats.

They can still run in the upcoming election, but without parliamentary immunity. Immunity from arrest is a great benefit in Cambodia's highly contentious elections, and those without it are at risk of being charged with defamation for remarks seen critical of Hun Sen and his government.

For Hun Sen, the move pre-empts some of the criticism that the election is unfair. He has used similar tactics before, pressuring his opponents until they were in disarray, then making conciliatory gestures at the last minute.

Sam Rainsy went into exile after he was convicted and sentenced to two years in prison for moving border markers at the frontier with Vietnam, seven years for spreading false information about the border with Vietnam and two years for defaming Foreign Minister Hor Namhong by associating him with the genocidal Khmer Rouge regime of the late 1970s.

One of Sam Rainsy's political tactics is to appeal to Cambodian nationalism by speaking out against Vietnam, the country's traditional enemy. Hun Sen enjoys good relations with Hanoi, which helped install him in what was then its proxy regime after it invaded Cambodia to oust the Khmer Rouge in 1979.