A 12-year-old girl is suing her school in Minnesota after being forced to hand over her Facebook password and punished for posts she made on the social networking site.
The case has been brought by the American Civil Liberties Union (ACLU), and comes amid growing concern in the United States about individuals' ability to keep their email and other online accounts secret from their school, employer and government authorities.
A number of prospective employees have complained that they were forced to hand over their passwords to Facebook and Twitter when applying for jobs.
In the Minnesota case, the 12-year-old girl, known only as RS, is said to have been punished by teachers at Minnewaska Area Middle School for things she wrote on Facebook while at home, and using her own computer.
The ACLU is arguing that her First and Fourth Amendment rights, which protect freedom of speech and freedom from illegal searches respectively, were violated.
She is said to have been punished with detention after using Facebook to criticise a school hall monitor, and again after a fellow student told teachers that she had discussed sex online.
Legal papers, filed by the ACLU say: "RS was intimidated, frightened, humiliated and sobbing while she was detained in the small school room," while school staff and a sheriff's deputy read her private messages.
It went on: "RS was extremely nervous and being called out of class and being interrogated." The lawsuit says that the mother of RS had not given permission for the viewing.
A spokesman for the school district said: "The district is confident that once all facts come to light, the district's conduct will be found to be reasonable and appropriate."
The case highlights growing concern in the US about the extent to which supposedly private communications can be kept from those in authority.
The ACLU recently forced the Department of Corrections in Maryland to stop requiring applicants to provide their Facebook passwords when applying for jobs.
The Union claims job seekers are now asked to "voluntarily" log into their accounts during interviews, displaying potentially embarrassing photographs and messages. Most comply because they are afraid they will otherwise miss out on the job.
The Department told the ACLU it was seeking to weed out applicants with links to gangs.
In an recent investigation, the TV station MSNBC found that many university sports departments now require students to "friend" their coach, giving officials access to their "friends-only" posts.
The University of North Carolina handbook reads: "Each team must identify at least one coach or administrator who is responsible for having access to and regularly monitoring the content of team members' social networking sites and postings.
"The athletics department also reserves the right to have other staff members monitor athletes' posts."