Having endured the horror of enslavement working on board merchant vessels between Greenock and the West Indies, James Graham’s fortunes appeared to have taken a turn for the better.

It was December 1781 and, no longer an enslaved man, he was finally free with a job as an apprentice for one of Glasgow’s busy carpet weaving companies.

The Royal Navy of the day, however, desperately needed men. And James Graham would find out that it particularly needed men with extensive seafaring experience, regardless of whether it was gained while they suffered the indignity and distress of enslavement.

As newly digitised Scottish Court of Session papers show, before long James would be at the centre of a bitter legal dispute involving the highest civil court in the country, with his future as a free man to do as he pleased, at stake.

The case between Lieutenant William Stewart of the Impress Service at Greenock and James Graham, described in the papers as “a negro, residing in Glasgow, who had been born into the business of a seaman” has been uncovered as part of a cross-Atlantic project to unravel thousands of legal documents.

The papers, spanning 75 years from 1759 to 1834, include litigation and testimony documents, letters, wills, business contracts, bankruptcy details and other evidence gathered by lawyers of the time in an effort to prove their cases.

But more than simply legal documents, they tell the often gripping day to day stories of ordinary Scots, among them women – whose cases often involve battling men accused of abandoning them with children or leaving them penniless – servants, bankrupt businessmen, tenants fighting difficult landlords, siblings fighting over inheritance and, in the case of Graham, formerly enslaved men striving to keep their freedom.

Around 250,000 documents, some stretching to hundreds of pages, are being carefully untangled and digitised by a transatlantic team of researchers, archivists and digital detectives in a join project involving Edinburgh University and the University of Virginia Law Library. Dozens of cases have now uploaded to a dedicated website.

Because of the ‘ordinary’ nature of most legal disputes – albeit of huge significance to those directly affected - few in the massive collection would have made headlines at the time.

The result is a largely untapped collection of documents which throws light on the daily trials and tribulations of life in Scotland for a layer of society whose voices are rarely heard in historic papers.

The court documents also reveal the attitudes of legal and establishment figures of the times to those who sought help in settling often disturbing and complicated disputes, and the sometimes harsh but, at the time, legally sound decisions which could easily plunge them into poverty or, in the case of James Graham, a life they did not want.

In his case, the question facing the court was whether James Graham was the experienced seaman that Lieutenant Stewart thought he was – and therefore a suitable candidate to be impressed into Royal Navy service – or, indeed, an unwilling servant forced into working on board countless voyages between Scotland and the Caribbean.

The case threw up complex legal discussions over the question of slavery, citizenship and what freedom meant for formerly enslaved people.

According to the papers, James Graham had been enslaved to Captain Daniel Graham who had “purchased (him) at St Kitts” while he was still a child and “bred up by him as a sailor”.

“The deponent considered himself as entitled to draw Graham’s wages, who he considered as his slave,” the papers state. As a result, the captain kept whatever money James made, and paid him in “meat and clothes” with occasional “pocket money”.

The situation continued for 24 years until Capt Graham gave up his business in 1779 and James entered employment with the Glasgow carpet firm.

However, pressure was growing on the Royal Navy at the time to boost its numbers, leading to James being served with impress papers, arrested and jailed.

Graham’s new employers, Grant, Wood, and Company, a carpet manufacturing company, filed a petition on his behalf. However, James appeared for himself in the case to argue that he did not fit the description of a seaman as described in the warrant.

Magistrates in Glasgow agreed, ruling he could not be impressed into naval service because he did not voluntarily choose a seafaring life.

It sparked an appeal to the Court of Session, which was heard by 12 judges.

Complex legal arguments swirled around how the law should treat formerly enslaved people, their citizenship and what obligations they owned to the nation. Eventually, the judges turned down Lieutenant Stewart’s petition, giving James the chance to return to his new life.

Records contained with the Court of Session documents include wrangles of debts, family squabbles over inheritance, divorces, and rows over land, among them some which spilled over from the 1745 Jacobite Rebellion which saw landowners who convicted of treason for their support of the uprising, had their estates forfeited to the Crown.

Scottish courts ordered documents be printed in the early 18th century to avoid the laborious practice of copying petitions and evidence by hand.

The move made thousands of documents easier for modern researchers to navigate. But while they are contained with dozens of thick volumes, the archive is spread across libraries in North America and the UK.

The project aims to split the cases into themes, with currently online sections covering areas such as family litigation, land use, labour, military and war, women and the law, slavery and freedom, commerce, and several others.

Dr James P. Ambuske co-director of the Scottish Court of Session Digital Archive Project at the University of Virginia Law Library, said: “These are stories of people at their very worst and their very best, waiting to be told, and because they are printed documents, once digitized we can use advanced technology to reassemble complete cases, make them fully searchable, and organize them thematically to inspire new questions about the past.

“This is the kind of project historians dream of."

The cases already uploaded include the 1799 case of Isabella Clerk, a young woman who sued her brother, Sir George, arguing that she had been left “wholly unprovided for” following the death of their father.

Sir George, the court was told, had succeeded to his great grandfather’s estate, worth upwards of £2,000 per year. Miss Clerk asked the court for £60 yearly arguing they were obligated to provide for her.

Sir George claimed that natural law did not compel him to support siblings, but only his parents and children – and the court agreed.

One 1786 case involved the right of residents of Dumbarton to receive fish from the rivers Clyde and Leven.

According to the digitised content on the University of Virginia Law Library’s SCOS Archive, Dumbarton’s crown charter conferred certain fishing rights on “the bailies, burgesses, counsellors, community, and inhabitants” of the town.

For more than 100 years, the town had let tacksmen – who leased land - fish on the understanding they sold their catch in the town market at a low rate.

When magistrates decided to issue tacks without such a restriction, the townsfolk reacted with fury, and lodged a petition arguing they had personal interest in the salmon catches.

Digitisation of the papers is a slow process because of the size of the surviving materials, the need to secure major funding to conserve them and staff time to catalogue them.

Dr Ambuske added: “Session Papers are remarkable and largely untapped sources of Scotland's cultural heritage.

“A conservative estimate is that there are at least 250,000 surviving documents dating from the 18th through the early 19th centuries, and we are aware of more in institutional and private collections beyond our current project partners' holdings.

“When we consider that a single document can range anywhere from one to several hundred pages, we have the opportunity to make discoverable a gigantic swath of history to academic and general researchers alike.

“They will allow scholars to write new histories of Scotland, Great Britain, and North America in an era of revolutionary change.”

The case documents and digitised archives can be viewed at https://scos.law.virginia.edu