KABUL (Reuters) - Afghan President Ashraf Ghani was sworn in for a second term on Monday, but the ceremony was marred by a rocket attack and a rival held his own inauguration ceremony in an escalating political feud compounding challenges to ending the 18-year war.

Both Ghani and former chief executive Abdullah Abdullah say they are Afghanistan’s rightful leader following a disputed election last September. The standoff threatens political chaos days after the United States and the Taliban signed a deal on the withdrawal of U.S.-led international forces.

Planned morning ceremonies were postponed and guests kept waiting while U.S. Special Envoy Zalmay Khalilzad tried to broker a last-minute deal between the longtime political foes - but there was no word of a breakthrough.

Ghani eventually took an oath at the presidential palace in a ceremony attended by foreign diplomats including Khalilzad and NATO forces commander Scott Miller.

Abdullah held a ceremony at his own compound nearby attended by supporters.

Hours after the competing ceremonies, U.S. Secretary of State Mike Pompeo issued a statement saying that the United States “strongly” opposes the creation of a “parallel government, and any use of force to resolve political differences.”

The warning appeared primarily aimed at Abdullah. But Pompeo also withheld congratulating Ghani on being sworn-in to a second five-year term. Instead, he expressed support for a pledge by Ghani to continue talks for the next two weeks on forming an “inclusive government that unifies the country and prioritises peace.”

Ghani’s ceremony was disrupted by the sound of rockets hitting the edge of the compound of the presidential palace in an attack later claimed by Islamic State.

The Ministry of Interior said four rockets were launched from a car, injuring one policeman. As some attendees ducked and ran for cover, Ghani briefly paused his address, saying: “Do not be afraid of one or two explosions, stay in your seats.”

Returning to his speech, Ghani said he would stick to his previous cabinet for two weeks before selecting new members who would include people beyond his political camp to form “an inclusive government.”

He plans to finalise a negotiating team for talks with the Taliban on Tuesday and to make a further announcement on demands by the militants for the release of 5,000 prisoners.

The Taliban, which has waged an insurgency since shortly after its fall from power in 2001, has made their release a condition for talks but Ghani has rejected the demand.

‘COMPLETE MESS’

Slideshow ( 7 images )

Despite Ghani’s announcements, many diplomats, experts and civil society members believe the political crisis does not bode well for talks with the Taliban, known as “intra-Afghan talks”, under a U.S. brokered peace process.

“It’s a worst-case scenario for sure,” said Michael Kugelman, deputy director of the Asia Program at the Wilson Center. “The question is how you get two separate Afghan governments into an already complex negotiation with the Taliban?”

The talks are intended as a follow-up to the Feb. 29 pact on the withdrawal of U.S. troops.

Slideshow ( 7 images )

U.S. and Western diplomats told Reuters that an arrangement will have to be brokered quickly before the two start appointing rival ministers.

“It’s a complete mess, the two men refuse to negotiate a deal,” said a senior American official in Kabul.

Ghani and Abdullah had been holding talks with Khalilzad as the U.S. special envoy tried to secure a deal to avert the parallel inaugurations, officials from both camps said. The U.S. State Department declined to comment.

The Election Commission last month announced that Ghani had retained power by winning the September. 28 election. But Abdullah proclaimed himself winner.

“No one should have underestimated our commitment to genuine democracy,” Abdullah tweeted on Monday.

“Invalidation of all fraudulent votes is the way out.”

Ghani and Abdullah both held roles in the previous government under a U.S.-brokered, power-sharing agreement that followed the 2014 election.

Publicly, many embassies and international players including Canada and the United Nations congratulated Ghani.

But there was frustration too.

Aisha Khurram, a student at Kabul University and Afghanistan’s youth representative to the United Nations last year, tweeted: “Game of thrones: Our country is literally on the brink of division. Shame on our authorities for ... jeopardizing the nascent peace process. You failed this generation!”