The advice to the executive, contained in declassified papers, stated that the flying of the flag was a matter for the “discretion” of individual ministers.
The information is contained in briefing papers for a meeting of ministers of the newly formed executive in February 2000.
It includes a note from the executive secretariat which said there had been discussion at the previous executive meeting on January 11 about the flying of the Union flag from official buildings.
It followed the issuing of guidance from the Department of Culture, Media and Sport in Westminster which laid out the protocol and days the flag should be flown.
The note said the secretariat had taken legal advice on two occasions from the department’s solicitor and invited ministers to “seek to agree an executive policy on this issue”.
The legal advice from Denis McCartney from the departmental solicitors’ office said he had “not been able to find any statutory provision relating to the flying of the Union flag”.
He said research going back to 1927 indicated “it would appear that the flying of the Union flag was regarded as a prerogative matter”.
He added: “There is nothing in the Government of Ireland Act 1920, the Northern Ireland Constitution Act 1973 or the Northern Ireland Act 1998, to suggest that the flying of flags from the buildings of the Northern Ireland administration is other than a transferred matter.”
The lawyer continued: “I have to say I have doubts on whether the flying of the Union flag is truly a matter the authority for which relies on the prerogative or other executive powers of Her Majesty, exercisable by Northern Ireland departments.
“Any person may fly any flag, including the Union flag, (in which there does not appear to be any ownership) on their property, and a department’s decision to do so may simply be a matter of lawful administration, rather than an exercise of a prerogative or executive power delegated to Ministers and departments under section 23.”
He said: “It is clear that this, as a transferred matter, is for decision of Ministers, rather than a legal imperative by direction of Her Majesty.
“Accordingly, subject to any agreement which may be made in the Executive Committee, the issue of the flying of the Union flag from government buildings is for individual Ministerial discretion.”
He provided further advice on January 25 on whether there existed in the Crown some “residual power by which government departments in Northern Ireland can be commanded by Her Majesty to fly the Union flag”.
He said the regulations from the Department of Culture, Media and Sport “are certainly issued in the language of command of Her Majesty”.
He also said “the list of days for hoisting flags on government buildings is also clearly intended to apply on a UK-wide basis”.
But the lawyer added: “Whatever the status of this command in Great Britain, it is drafted in terms which disregard the constitutional arrangements for Northern Ireland.
“The prerogative only exists to the extent that it is not removed or constrained by Parliamentary intervention, and that Parliamentary intervention is now contained in the Northern Ireland Act 1998.”
He concluded: “I have discussed this briefly and informally with Home Office lawyers.
“They agree that, whatever the status of the command on flags in GB, it is without legal authority in Northern Ireland.”
The file also includes a letter from then Department for Social Development minister Nigel Dodds, sent the day before the executive meeting.
He said: “I wish to register in the strongest terms possible my opposition to any Minister who refuses to abide by the Schedule for Days for Hoisting Flags on Government buildings as set out by the Department of Culture, Media and Sport.
“This is clearly intended to apply on a UK-wide basis.
“There should be a consistent policy across all Departments that the national flag will fly from appropriate buildings on the designated days.”

The executive meeting on February 1 was attended by then first minister David Trimble and deputy first minister Seamus Mallon.
Minutes from the meeting show the discussion on flying of flags was “deferred”.
Later in the month the powersharing executive was suspended by then Northern Ireland secretary Peter Mandelson due to a lack of progress on IRA decommissioning.