A planning decision which prompted a retail giant to leave a Scots town has been quashed.
Next wanted to vacate a town centre site in Dumfries and move to an out-of-town unit in a retail park.
The Scottish government's planning and environmental appeals division rejected the bid and the company shut its store in February.
However, the DPEA has now confirmed it will have to re-examine the case after its original decision was quashed.
The development is the latest twist in a long-running planning battle by the firm to be allowed to switch to a larger out-of-town site.
Next argued turnover had fallen significantly at a unit it operated at the Loreburne Centre in the heart of the town which no longer suited its business model.
However, Dumfries and Galloway Council rejected proposals to lift a planning condition on the goods that can be sold at the out-of-town retail park, which would have allowed the company to move in.
The local authority claimed it had not been shown there was no viable town centre alternative.
That decision was taken on appeal to the Scottish government but rejected again and Next shut its Dumfries store in February.
The DPEA has now revealed that it will have to look again at the bid at the Cuckoo Bridge Retail Park which could allow the company to take up occupancy.
"I can confirm that this decision was quashed by the Court of Session," said a spokeswoman.
"The case will now be returned to DPEA to re-determine, and parties to the previous appeal will be contacted in this regard in due course.
"The case is currently awaiting allocation to a reporter and the re-determination of the case will look at the whole appeal afresh."
A spokeswoman for Next confirmed it was still keen to have a store in the town.
"We remain interested in returning to Dumfries, but only at Cuckoo Bridge Retail Park, not the town centre," she said.
"The previous planning appeal decision has been quashed, and we are expecting a new planning inspector to be appointed within the next couple of weeks to re-hear the appeal."