The Afghan president, Hamid Karzai, has been talking to the Taliban for several months in an attempt to broker a last-minute peace deal before his term expires, the New York Times reports, citing Afghan and western officials.

If confirmed, the clandestine contacts could explain his hardening stance towards Washington in recent weeks, which has further soured an already difficult relationship.

The outreach to the Taliban began last November, just as Washington believed a deal for a long-term US military presence in Afghanistan was about to be signed.

After a national gathering convened to discuss the bilateral agreement endorsed it, Karzai surprised allies and much of his own cabinet by rolling out a new list of conditions.

The strategic deal is still unsigned, and billions of dollars in military and civilian aid linked to it are also in limbo.

Since then, relations between Kabul and Washington have deteriorated further with the revelation that Karzai suspects the US is behind many insurgent-style attacks, including a recent suicide assault on a restaurant in the Afghan capital that killed prominent members of the international community and two US citizens.

He has also ordered the release of dozens of prisoners considered by the US to be dangerous Taliban fighters. His office insists they are innocent men locked up by the US under false pretences.

Afghanistan will vote for a new president in April. But the two-stage system and delays getting ballot boxes from across the country could mean that Karzai will remain in post for several months after.

The contacts with the Taliban do not appear to have yielded any concrete results, the New York Times reported, with neither actual talks nor firm plans for any on the table.

A presidential spokesman confirmed the talks, which he described as among the most serious of the last decade.

"These parties were encouraged by the president's stance on the bilateral security agreement and his speeches afterwards," Aimal Faizi told the paper. "The last two months have been very positive."

He was not available for comment on Tuesday.

There were meetings with influential leaders in Dubai and Riyadh, the report said, but contacts had "fizzled out" and the group had no plans of negotiating with the Afghan government, if they ever did.

The Taliban have long said getting rid of foreign troops is one of their main objectives, and if their links with Karzai contributed to slow progress on the long-term partnership deal with the US, it could potentially be part of a military strategy.

Although the Taliban maintained unofficial contacts with some senior Afghans over the decade since they were toppled, efforts to broker peace talks to end the conflict through negotiations have been tortuous and so far yielded little more than set-backs and dead ends.