A senior UN official in Afghanistan is to be removed from his post following a row about the country's presidential election, the BBC has learned.
UN officials said Peter Galbraith had not been fired but would be removed from the mission.
Mr Galbraith, a US diplomat, said: "The secretary general appointed me and has not fired me so far as I know."
Mr Galbraith angered Afghan President Hamid Karzai by reportedly calling for a complete recount of the vote.
Last week the top UN Afghan envoy, Kai Eide, said Mr Galbraith had left the country after a row between them.
But he denied he had ordered him to go.
UN sources say Secretary General Ban Ki-moon decided to end Mr Galbraith's mission after it became clear he was no longer able to carry out his work in Afghanistan, says the BBC's Lyse Doucet.
Some Afghan cabinet ministers had said they no longer wanted to work with him.
It is understood that Mr Galbraith would have been kept in his post until after a final ruling on the disputed presidential election - a process that is in its final stages - but leaks emerged in Kabul before Mr Galbraith himself had been informed of the secretary general's decision, said Ms Doucet.
A UN spokesman in Kabul told the BBC: "We are aware of the reports. An announcement of this nature would come from the UN secretary general's office in New York. At this stage there has been no announcement".
Last week, Mr Eide told the BBC the dispute had been resolved by Mr Galbraith agreeing to leave the country for a while.
He described Mr Galbraith as "a valuable deputy" and said he hoped they could "re-establish a good team and work together".
Mr Eide declined to talk about details of his disagreement with Mr Galbraith, but said the UN should respect the constitutional bodies in charge of the presidential election "to avoid any impression that there is foreign interference".
The row is between two men who have known each other for a long time but have very different styles, but a UN source said that had not been the only factor in Mr Galbraith's removal, Lyse Doucet says.
It is understood that Mr Ban would not have dismissed Mr Galbraith - who came to the post with US support - without backing from the Washington, she adds.
The US, along with other foreign missions in Afghanistan, appears to want to move on from the election dispute to deal with the country's other considerable problems, she says, but this will anger observers who believe a more robust response is needed to the allegations.
EU election observers have said that about 1.5m votes - about a quarter of all ballots - cast in August's presidential vote could be fraudulent.
They say that 1.1 million votes cast for President Karzai are suspicious.