Image caption Has school discipline been handed over to police and the courts?

Hundreds of US schools have police patrolling the playgrounds and corridors to keep order. But some believe their presence means an increasing number of pupils are being criminalised for minor classroom offences.

Judge John Sholden sits, dressed in black robes, in between two American flags and calls out names.

He is looking down on a courtroom full of teenagers and their parents who are facing "Class C" misdemeanour offences for skipping school.

At the truancy courts of Dallas in Texas, absence from class or repeated late arrivals are punishable with fines of up to $500 (£316).

"A Class C misdemeanour is the lowest level of all the criminal offences, it would be the equivalent of a traffic ticket or not abiding by a stop sign on the street," says Judge Sholden, who can also hand out sanctions like essays and book reports in his sentence.

The use of the court system to correct student behaviour is a popular policy used in schools across Texas.

Class C convictions Truancy

Being 10 or 15 minutes late

Class disruption, including talking in class, profanity and fights

Uniform infringements officially exempt in 2007

But tickets still issued for not tucking in shirts

Writing on a desk

A recent study put the number of Class C tickets issued to young people at around 300,000 per year.

Many of these tickets were for classroom disruptions and truancy but also included some minor misbehaviour problems.

Alison Brim, from the Texas Organizing Project, a group which campaigns for low and moderate income families, has come across examples of minor school disciplinary matters being referred to police officers, stationed permanently inside nearly all local high schools.

"I ran into a mother recently whose daughter wrote her name on a school desk in highlighter and she was given a felony conviction for that.

A substantial number of kids were getting Class C misdemeanours for violation of some minor school rules Jerry Madden, Texas House Member

"There are police at every high school. Just to give you an idea, the school districts here in Dallas spend $20million (£12.6m) on security and surveillance each school year".

Although welcomed by those people reassured by the extra security, this expanding role of police is blurring the lines between school discipline and the criminal justice system.

Students who are creating a problem for teachers in the classroom can be referred to a police officer, which makes it easier for the matter to end up in the courts.

A retired teacher and volunteer assistant in local schools, Dorothy Robinson, has been working with children for more than 50 years.

She is worried about the young people she sees as entering a "school to prison pipeline", where misbehaviour in school can be escalated to the point where the child faces a risk of suspension or even worse, a criminal conviction.

Find out more The School to Prison Pipeline was on the BBC World Service on 10 April

Listen again using the link below The School to Prison Pipeline

"I've seen children being disciplined for the wrong colour belt, the wrong colour tennis shoes. A majority of things are just so silly. They are normal things that children are just going to do, like talking in class and being a little bit disruptive.

"Teachers used to be able to manage their students and police were there just as a backup, but now what I'm seeing is that security and police are intervening all the time."

Class C tickets being given out for minor infractions of school policies came to the attention of Republican member of the Texas Legislature, Representative Jerry Madden, in 2007.

He was trying to reduce the number of people entering the state's prisons, which were filling up to capacity and placing a costly burden on the taxpayer.

Image caption Joseph Wallace, 13, says pupils have been ordered to court for not tucking in shirts

He thought that the best way to stem the flow of new prisoners was to look at those coming from schools.

"We found out there were a substantial number of kids who were getting Class C misdemeanours for violation of some minor school rules."

So, a bill was passed to try and outlaw the practice of issuing tickets for the more minor infringements, like breaking school uniform rules.

It did not attempt to change the law on giving out tickets for other reasons like class disruptions and truancy. But five years on, there are still discretionary tickets being issued for swearing or wearing banned jewellery.

In a study of 1m Texan students... Nearly six in 10 were suspended or expelled at least once between ages 12 and 18

Only 3% of these were for conduct for which state law mandates suspensions/ expulsions, the rest were discretionary

About 10% of students suspended or expelled between 12 and 18 dropped out, compared with just 2% of students with no disciplinary action

About 59% of those students disciplined 11 times or more did not graduate from high school

More than one in seven Texas middle and high school students have been involved with the juvenile justice system.

83% of African-American male students ended up in trouble, 74% of Hispanic male students and 59% of white male students

Six out of 10 black male school dropouts will spend time in prison Source: Council of State Governments Justice Center, Public Policy Research Institute, Texas Read more about the study

Thirteen-year-old Joseph Wallace used to attend a school last year that took a zero-tolerance approach to discipline. He saw children being given tickets for not tucking in their shirts.

But, the threat of going to court did not have the desired effect in correcting behaviour.

"I know kids who had tickets and they would rip them up and not pay them. Then about a month later, I saw the police come and take them to jail."

In a show of defiance against authority, young people who do not fulfil the terms of their Class C ticket can find themselves landing much deeper inside the criminal justice system.

Back in Judge Sholden's courtroom, there are many repeat truancy offenders present including 17-year-old Scott, who is making his fourth appearance for skipping school.

His teeth are in braces and he wears baggy jeans, but despite numerous fines which now total more than $2,500 (£1,579), he still does not intend to go back to school.

His brother also received many Class C tickets for truancy and is now locked up in adult prison.

Scott says he doesn't want to end up on the same path as his brother, but with more than one in seven Texas students now involved with the juvenile justice system, the odds are not in his favour.

Hear the full documentary on the BBC World Service