Tal Abyad, Syria, and Erbil, Iraq - Documents obtained by Al Jazeera from the Islamic State of Iraq and the Levant's (ISIL) offices in the northern Syrian town of Tal Abyad shed light on how the group implements draconian laws in areas under its control.

The documents also reveal the degree of organisation ISIL has achieved in the nearly two years since its emergence.

The town of Tal Abyad is located on the Syrian-Turkish border. It came under ISIL's grip in June 2014, when the group seized the town from armed rebel groups fighting against Syrian President Bashar al-Assad's government.

RELATED: US and Turkey discuss 'ISIL-free zone' in Syria

But last month, combined forces from the Kurdish People's Protection Units (YPG) and other rebel groups, assisted by air strikes from the US-led international coalition against ISIL, expelled its fighters from the town.

Under ISIL, the Tal Abyad region's estimated 200,000 residents were held accountable for any deviations from the group's understanding of "Islamic" norms.

In one document dated May 12, 2015, by ISIL's religious and morality police, known as al-Hisba, a man was detained for "not attending Friday prayers in the mosque".

He was forced by an ISIL religious judge to fill out a "pledge" document that if he committed the same violation again, he would "accept any ruling imposed by the Hisba centre", without specifying what the punishment would be.

Another document reveals that a man was made to sign a pledge form on charges of "lying", though the judge did not elaborate on the charges or what the punishment would be if a second offence were committed.

Other charges for which Hisba police detained Tal Abyad residents included not knowing how to pray, shaving their beards, smuggling cigarettes and even smoking.

ISIL has not been shy in advertising its form of governance, even though most of the outside world regards its practises as brutal or bizarre.

The armed group has been especially zealous in regulating women's behaviour in areas it controls in Syria and Iraq.

A number of documents obtained by Al Jazeera show how the group has often tried to do this by applying strong pressure on their male relatives.

Three Tal Abyad men were detained by ISIL on the charge that their female relatives had applied make-up while outdoors.

Similar to other cases, Hisba police forced the men to sign papers accepting to be subjected to an unspecified future punishment by the group if their female family members again committed the alleged violation.

Authorities even kept a book of travel permits for women in ISIL-held areas. One document from April 2015 granted permission to a female resident of Tal Abyad to travel to the city of Raqqa, ISIL's de facto capital. The permit was valid for only one day after its issuance.

It did not specify the cause of travel, or whether it was necessary for the woman to be accompanied by male relatives on her journey.

Nor did ISIL limit its concerns to women's dress. They also regulated the traditional ankle-length Arab garments worn by men, known as the thobe or dishdasha.

Abu Ahmed works as a taxi driver in Tal Abyad and has first-hand experience of life under ISIL in the town. "Sometimes even men were stopped on the streets if their garments were [the wrong length]," he recalled.

Two documents obtained by Al Jazeera show that men were forced to fill out papers in which they pledged to change their style of dress, or else accept any punishment handed to them by the group.

The documents reveal a group obsessed with regulating its understanding of morality in its territories.

As has become well known in the past two years, ISIL seeks to command obedience among people living under its control by the use of public punishments, and by then advertising these gruesome scenes.

Tal Abyad residents occasionally had to endure such spectacles.

"They used to whip people, even sometimes minors, for things like smoking," said Ridhwan Bayzar, a resident of Tal Abyad. "They had placed a cage at the entrance to the town and put people in them, sometimes for days, as a form of punishment... There were several instances of beheadings in the town."

They had placed a cage at the entrance to the town and put people in them, sometimes for days, as a form of punishment. Ridhwan Bayzar, resident of Tal Abyad

ISIL also took steps to educate individuals not familiar with what it deemed to be mandatory religious practices.

One document dated May 19, 2015, referred a resident of Kurmazo, a small town near Tal Abyad, to relevant authorities to be put through a "Sharia course" because he did not know how to say prayers or perform ablution, an act of washing certain body parts to prepare for prayers.

ISIL has also taken a harsh approach towards seemingly innocuous forms of entertainment.

A document issued in mid-May by Yusef bin Salih al-Arabi, head of the Hisba religious police, instructed the governor of Raqqa province to ban billiard halls throughout the group's territory.

"Inform the owners of those [billiard] halls to change their activities to something other than this game; they can also transfer [their billiard tools] outside the territories of the Islamic State ... or if an owner desires compensation, they can raise an appeal to the Office of Judiciary and Grievances," read the document.

As the documents demonstrate, ISIL has a seemingly functioning bureaucracy that keeps daily records of affairs in its territory and orders issued.

"This shows that [ISIL] wants to give the impression of living up to the principle of the rule of law, and not being random in its law enforcement," Maurits Berger, a professor of Islam and the West at the Institute for Religious Studies at the Netherlands' Leiden University, told Al Jazeera.

With ISIL gone, Tal Abyad now strives to be a different town, and many of those who fled ISIL's rule - by some accounts over 20,000 - have been returning.

"Life is now very different," Bayzar said. "People now have freedom in terms of what they want to wear, religion and their beliefs."

Although many hope Tal Abyad's days of ISIL rule are behind them, ISIL seems determined not to give up on the town. On June 30, ISIL fighters launched a surprise attack and captured one district in Tal Abyad, but were repelled the next day.