Some communications between the Scottish Executive and the Home Office on children held at an immigration detention centre must be released.
The Scottish Executive must hand over documents within two months
The ruling came from Scottish Information Commissioner Kevin Dunion, who said no substantial harm would be caused by disclosing the records.
His decision partly upholds an appeal by SNP MSP Christine Grahame.
She sought communications about the detention of children at Dungavel detention centre in Lanarkshire.
The decision involves 27 documents or groups of documents.
Of these, seven were judged to be outside the scope of the request.
Four of the remaining 20 are to be entirely disclosed, 11 are to be disclosed in part and five are to be withheld.
Mr Dunion said: "The fact of the executive's dialogue with the Home Office on the topic of Dungavel is a matter of public record.
"I have concluded that substantial harm would not be caused to this process by the disclosure of a number of documents.
"As a consequence, release of this information will provide some insight into the nature of the exchanges that took place between the Home Office and the executive and the respective roles of those parties."
The executive must now hand over the information requested within two months or appeal within 42 days to the Court of Session.
A spokeswoman said the executive was considering the decision and would respond in due course.