The imprisonment of Gerry Adams more than 40 years ago was unlawful because of flaws in the detention process, the Court of Appeal has heard.
Mr Adams, who is due to stand down as Sinn Féin president next month, has launched a legal bid to overturn two convictions received in 1975 while he was detained without trial at the Maze Prison during the early 1970s.
The challenge hinges on a complex technicality that Mr Adams' internment was not lawful because the order to hold him had not been considered by the then secretary of state.
The matter was explored at length before three of Northern Ireland's most senior judges led by Lord Chief Justice Declan Morgan at Belfast's Royal Courts of Justice.
Mr Adams, who was not present for the hearing, was among hundreds of people held without trial during the height of the Troubles in Northern Ireland.
The Louth TD was first detained in March 1972, but was released in June that year to take part in secret talks in London.
He was rearrested in July 1973 at a Belfast house and interned at the Maze Prison, also known as Long Kesh internment camp.
He is challenging convictions handed down by two separate Diplock Court trials - cases tried by a single judge sitting without a jury - relating to two attempts to escape from internment.
The Court of Appeal heard that on Christmas Eve, 1973, he was among four detainees caught attempting to break out of the Maze.
Barrister Sean Doran QC, who is representing the veteran politician, said: "A hole had been cut in the perimeter fence and all four were already through."
The second escape bid in July 1974 was described as an "elaborate scheme" which included the kidnap of a man, who bore a "striking resemblance" to Mr Adams, from a bus stop in west Belfast.
The man was taken to a house where his hair was dyed and he was given a false beard, the court heard.
The man was then taken to the Maze where he was to be substituted for Mr Adams in a visiting hut.
However, prison staff were alerted to the plan and Mr Adams was arrested in the car park of the jail, the court heard.
He was subsequently sentenced to 18 months in jail for attempting to escape.
"Each conviction is for attempting to escape from lawful custody," said Mr Doran.
However, Mr Adams' legal team have argued that his imprisonment was not lawful because an interim custody order was signed by a junior minister at the Northern Ireland Office and not the Secretary of State.
They contest that the 1972 Detention of Terrorists Order required senior level authorisation, from the Northern Secretary of the day.
Mr Doran said: "There is a very clear distinction made in the wording of the legislation between, on the one hand, the
power to make an order and, on the other hand, the power to sign an order.
"It's only the Secretary of State who can be responsible for the decision to make the order."
The lawyer added that documents presented to the court appeared to "copper fasten submissions that there was not personal consideration of the case".
Meanwhile, prosecution barrister Gerry Simpson QC said the Secretary of State could not be expected to be across every case.
Referring to a principle whereby an official within a government department can make a decision for the Secretary of State, he said: "This is a real Carltona case."
"The decision itself, under Carltona, can be taken by an official.
"The Minister signs it and so that it becomes a signed order for the governor of a prison to act on."
The move would also provide "political accountability".
Mr Simpson added: "It would be absurd to expect the Secretary of State to deal with every case."
Internment was introduced in 1971 for those suspected of involvement in violence.
The policy lasted until December 1975. During that time, 1,981 people were interned - 1,874 were nationalist and 107 were loyalist.
However, the introduction of internment, the way the arrests were carried out and the abuse of those arrested led to mass protests and a sharp increase in violence.
It is understood Mr Adams instigated legal proceedings after the Pat Finucane Centre recovered a document from the British National Archives in London.
Reserving judgement in the complicated case, Sir Declan Morgan said the three Appeal Court judges would take time to "reflect" on the submissions.
The case has been adjourned.