(CNN) Pakistan is due to vote next week in general elections overshadowed by deadly terrorist attacks, hundreds of arrests and accusations of widespread interference by the military.
The run up to the July 25 elections have seen a massive crackdown on the media and allegations the military has secretly backed the campaign of former cricketer Imran Khan while targeting his political opponents. Controversy has also arisen over allowing militant groups to participate in the poll.
The independent Human Rights Commission of Pakistan (HRCP) said there were "ample grounds to doubt" the legitimacy of the elections and criticized "blatant, aggressive and unabashed attempts to manipulate the outcome of the upcoming elections."
In a statement issued this week, the group added it "reaffirms the public perception that all parties have not been given equal freedom to run their election campaigns."
Khan has repeatedly denied claims he is linked to, or supported by the military, and condemned the harassment of election candidates.
Analysts fear that a doubtful election result may lead nuclear-armed Pakistan, a Muslim-majority South Asian nation of 208 million that has enjoyed several years of relative stability, into a renewed period of volatility.
Tensions have risen since the jailing of former Prime Minister Nawaz Sharif on corruption charges last week.
Sharif, who was sentenced in absentia on July 6, was jailed for 10 years on corruption-related charges which led to his removal from office last year.
The former premier, who was imprisoned on July 13 along with his daughter and presumed political heir, Maryam, claims the military is aiding a "judicial witch-hunt" to prevent the ruling Pakistan Muslim League-N (PML-N) from winning a second term in power.
The five-year tenure of Sharif's party has been hamstrung by hostility with the military, which was stung by criticism of its policy of backing militant proxies and Sharif's efforts to reconcile with arch-rival India.
Pakistan has been ruled by the military directly or indirectly for most of the country's 71-year history, maintaining tight control over defense and foreign policy and its own business empire.
Sharif's party said hundreds of its activists have been detained in his family's political stronghold of Lahore, the capital of Punjab province.
Following a pro-Sharif rally in the city last week, Pakistani authorities launched an anti-terrorism investigation against PML-N leaders and opened criminal cases against nearly 17,000 party members.
Political tensions have risen in tandem with fears over security. The same day Sharif was jailed, 150 people were killed in a suicide bombing, one of Pakistan's deadliest terrorist incidents and the worst since 2014.
The explosion in the southwest province of Baluchistan targeted the convoy of a political candidate. A strike on another politician the same day in Khyber Pakhtunkhwa province killed four people. Earlier in the week, at least 20 people died in a suicide attack in the northwest city of Peshawar.
The attacks, which were claimed by militant groups, have dented the credibility of the military's claim to have defeated terrorist groups.
Following an earlier attack, the military said it will deploy 371,000 troops to ensure a "fair and free" election.
However, HRCP expressed "serious reservations about the extraordinary powers accorded to security forces -- ostensibly to ensure the integrity of the polls".
It added the military deployment "has blurred the line between civilian and non-civilian responsibility for the electoral process."
Opinion polls indicate a close race between the PML-N and the Pakistan Tehreek-e-Insaf (PTI, or Pakistan Justice Movement) led by former cricket star Khan, who has run on a reformist, anti-corruption ticket.
The Pakistan People's Party (PPP), led by Bilawal Bhutto-Zardari, the son of assassinated former premier Benazir Bhutto, is expected to finish in third place.
The election will likely hinge on Punjab, the country's wealthiest and most populous province, and whether Khan can wrest it from PML-N.
The scion of an upper class family from Lahore, 65-year-old Khan founded PTI in 1996. His party's Khyber Pakhtunkhwa provincial government has been credited with effective reforms in education, health and the police system.
He has pledged to break the decades-old political stranglehold of the country's corruption-tarnished main parties, the PML-N and its rival PPP.
Khan, who peppers his speeches with anti-Western rhetoric, has also vowed to create an "Islamic welfare state" and reduce the nation's widening deficits by taxing the country's elite.
But he has struggled to fend off allegations that the military has bolstered his position. Both Sharif and the PPP allege members of the military's intelligence agency have put pressure on their lawmakers to change sides and help Khan to power.
"We don't have a political party. We don't have a loyalty," military spokesman Major General Asif Ghafoor told reporters earlier this month.
Fasi Zaka, a Pakistan-based political commentator and columnist, said Khan has spent the last four years signaling "his alignment with the army and the judiciary, and they have evolved common interests.
However, some believe the military may try to limit the sport star's power by engineering for him to be the head of a biddable coalition government.
"The army wants a pliable and corruption-free government. It already has a wide policy footprint in foreign relations and it is increasingly dragging its boots in domestically as well," said Zaka.
Rahimullah Yusufzai, a veteran political observer, said that Khan is untested administratively, and some military figures have expressed concern over "turncoats" within his party whose political loyalty cannot be guaranteed and Khan's unpredictability and lack of administrative experience.
Both the PPP and PML-N have criticized increasing censorship of TV channels, newspapers and social media in the run up to the election.
Gul Bukhari, a journalist and critic of the military, was briefly abducted in Lahore last month, an incident that prompted outrage and accusations of the army's involvement.
Journalists from respected newspaper Dawn have faced intimidation and harassment and hawkers have been banned from distributing the newspaper in military cantonments. Popular television channel Geo has also faced restrictions.
"This interference is absolutely unacceptable in a country that claims to be democratic," Daniel Bastard, the head of Reporters Without Borders' Asia-Pacific desk, said in a statement.
"We call on Pakistan's civilian and military authorities to let journalists work freely and inform the public without threats or reprisals. The respect of Pakistan's leaders for their fellow citizens and the country's international credibility are both at issue."
At the same time as the country's media is facing increasing restrictions, Pakistan is also witnessing an unprecedented number of extremist and militant groups being permitted to take part in the election, which analysts said could only happen with the military's blessing.
Last month, Mohammed Ahmed Ludhianvi, a notorious militant, was removed from Pakistan's terror watch list and his party allowed to contest the elections.
Terror group Lashkar-e-Taiba (or Army of the Faithful) has also put forward several hundred electoral candidates under a new name.
Lashkar was declared a global terrorist group in 2014 by the UN, and its leader Hafiz Saeed, accused of the masterminding the 2008 Mumbai terror attacks, has a $10 million bounty on his head.
"In theory, the space given to these groups should cut into the votes" of right wing parties like PML-N, said Zaka.
Yusufzai said the policy is "dangerous in the long term because they are getting a platform and mainstream parties, including Islamic ones, are losing support to them."
A week out, questions remain over how either leading party will deal with Pakistan's tempestuous relations with the US and Washington's ongoing war against the Taliban in neighboring Afghanistan.
President Donald Trump has accused Pakistan of not doing enough to root out Taliban militants who shelter on the Pakistani side of the border and his administration has cut military aid to Islamabad.
Financial and diplomatic pressure from Washington has come as Pakistan's economy is faltering and will likely require a bailout from the International Monetary Fund despite already taking billion dollar loans from ally China, which is currently building massive infrastructure projects in Pakistan.
Analysts said the elections will likely leave Pakistan in an even more precarious position.
"I don't expect the losers to accept the result. The government will be formed by a weak coalition. There may be protests," said Yusufzai.
"There will be tensions between provincial governments and the center and we will have not only economic and security problems but also political instability."