Austin Carroll was fighting insomnia when the teenager turned to Twitter for relief and casually dropped the F-word multiple times, apparently to demonstrate to his followers that the expletive would fit almost anywhere in a sentence.

But his middle-of-the-night profanity quickly cost him. A few days later, Carroll was expelled from high school over his foul-mouthed lapse, even though the word wasn't directed at anyone, and he says the tweet didn't involve his school.

Now the 17-year-old is at the centre of a debate over how closely US school officials may monitor students' online activities when they aren't in class or even on school property, an issue that has frustrated administrators and confounded courts.

Carroll insists he made the tweet on his own time using his own computer, making it none of the school's business. But school officials in the small city of Garrett, Indiana, contend that the teen used either his school-issued computer or the school network. The details could spell the difference between a routine school discipline case and a broader First Amendment dispute.

School officials say they cannot discuss a student's disciplinary record and will not say why Carroll was expelled March 19 from Garrett High School, a 600-student school where younger students are given iPads and older ones are sent home with MacBooks.

His mother, Pam Smith, believes it was in retaliation for her son's previous misbehaviour, which included a suspension earlier in March for violating the dress code by wearing a kilt to school and a suspension last fall for using the same expletive on a school computer. Then on March 16, her son tweeted the F-word again.

Carroll, who did not respond to interview requests from The Associated Press, told Fort Wayne television station WPTA that he was just trying to be funny.

"If my account is on my own personal account, I don't think the school or anybody should be looking at it. Because it's my own personal stuff, and it's none of their business," he told the station.

He posted on his Facebook page that he "shouldn't have done it" but said the punishment was too harsh.

First Amendment and students' rights experts agree with him. If Carroll was using his own computer and network to send the tweet, the school's action was "an incredible overreach and overreaction that arguably raises not only First Amendment but Fourth Amendment issues," said David Hudson, a scholar at the First Amendment Center at Vanderbilt University in Tennessee. The Fourth Amendment protects citizens against unreasonable searches and seizures.

Since 1969, the US Supreme Court has generally ruled that students have free-speech rights, and schools can prohibit their speech only if it is vulgar or disruptive to schoolwork or other people. But that power doesn't reach far beyond school property.

"I think it makes a big difference where this was done," said Ken Falk, legal director of the American Civil Liberties Union of Indiana.

Carroll insists he was not using his school-issued computer and was not logged onto the school network. His mother said her son had insomnia and was up tweeting at about 2.30am "What are they doing, following him 24/7?" she said.

School officials insist they are not.

"It was either on the school network or one of the school computers," said President Tony Griffin, vice president of the Garrett-Keyser-Butler school district. "It wasn't any of his own personal network or computer that caused this."

Superintendent Dennis Stockdale said the school computer network has a federally required filter that flags certain prohibited content, whether it's foul language or a pornographic website, anytime a student or teacher posts or accesses it.

Students must sign a "Respectable Use Policy" in which they agree not to visit websites or forward communications that are "inappropriate," but the document doesn't specifically mention language and says nothing about students' own posts.

Stockdale was uncertain whether a school computer might download Internet content that had been posted from a personal device earlier when a student logged onto their Twitter or Facebook account at school.

"Whether it's already on there or not ... if they bring it up on their school computer then, then it's a school issue," Stockdale said.

Legal experts say schools aren't getting much help from the courts. Lower court rulings have varied widely, and the Supreme Court has declined three times this term to review similar student off-campus speech.

"School officials don't really know what legal standard applies," said Emma Llanso, policy counsel at the Center for Democracy and Technology, a nonprofit public interest group in Washington.

With little help from the courts, school officials and state lawmakers across the US are groping for any kind of guidance on the issue.

New Jersey legislators last year passed a law aimed at curbing cyberbullying that also compels administrators to track students' online behaviour away from school.

"I think it's such a reach that it's absurd," said Charles Maranzano, superintendent of the Hopatcong, New Jersey, school district. "I think it's completely illegal that we're being asked to investigate into the private lives of people outside the schools."

Indiana lawmakers this year considered a bill that would have increased school officials' authority over off-campus behaviour. Supporters said it was motivated by concerns over bullying, but critics contended it was a response to a federal court ruling last August that found a northern Indiana school district violated the First Amendment rights of two teenage girls by punishing them for posting sexually suggestive photos on MySpace during their summer vacation.

The bill bogged down over First Amendment concerns and was referred to a study committee.

"As we got deeper and deeper into the subject, we found it becoming very complex ... particularly concerning technology," said the bill's author, Republican Representative Eric Koch of Bedford.

The committee's work will be too late to help Carroll, who will wrap up his year in an alternative school.

He will be allowed to graduate with his class but will miss his prom, a punishment Hudson said seems excessive.

"If they expelled every student that cursed, they won't have graduation," he said.