Singh responded, "We will go at like 7 so its not shady. Such a gay prank. Haha wow."

Those exchanges, officials say, were prelude to Singh and Khan, both 18, teaming up to steal an English test from a teacher before an upcoming exam.

Singh, who had been accepted at the University of California, San Diego, wanted to make sure that his grades remain high. The two broke into a classroom, were caught by a custodian and fled the scene, Susan Kang Schroeder, public affairs counsel at Orange County, California, said.

Her office alleges that between January and May Khan, who had low grades at the Tesoro High School, which has many students from affluent families like those of Singh and Khan, had been repeatedly breaking into school after hours with a stolen master key. He had been denied admission at several universities because of his grades. Tesoro is one of America's best-known public schools.

Officials said Khan used teachers' passwords to hack into computers and alter his grades and test scores, often changing the Cs and Fs he got into As. He also allegedly changed and/or upgraded the scores of many classmates, but officials are not sure whether he acted on his own.

Khan reportedly also sent copies of a test paper to several of his classmates. Khan, who like Singh was expected to graduate last week, is also charged with installing spyware that would let him access the school computer from a remote location. If found guilty Khan, who has been charged with 69 counts including ID theft and larceny, could face a maximum 38-year sentence. Singh, who is charged with four counts, could go to prison for three years if found guilty.

Authorities were not sure if Khan and Singh are citizens. If not, they could be deported to Pakistan and India respectively after serving a part of their sentence.

Khan's attorney Carol Lavacot said the authorities have blown up the case out of proportion  the story of the cyberhackers made headlines across the national media  and that she has been so busy talking to the press that she has had little time to work on the case.

In an interview with ABC News, she said 'there is a lot more to the story,' adding that she suspected several other students involved in what she called a cheating 'endemic' in California. The students are driven by unreasonable achievement expectations and pressure to get into good universities, she added.

She said she was surprised by the number of felony charges, and did not understand why Kahn was 'singled out, arrested and held for 10 hours at the Orange County Detention Center.'

Singh's attorney Merlin Stapleton told reporters that felony charges of burglary and computer fraud for his client were too severe.

"This is certainly not the first time we've heard of a kid cheating"' Stapleton said. "Sometimes they do these types of things simply to see if they can. The only thing that makes this case different is the technology used."

Cheating in schools and colleges across America, especially in preparing term papers, is an issue frequently discussed in the media. In recent years, there have been many stories of cheating at Ivy League schools including Princeton and Harvard, in courses ranging from business to, ironically, ethics.

The actions of these two students will likely be judged severely.

"These students are not accused of just committing simple Ferris Bueller-type offenses," said Deputy District Attorney Chuck Lawhorn, referring to the 1986 hit comedy film in which a school student sets up a crazy plan to spend a day away from the school with some of his classmates. "These are very serious crimes."

Tesoro Principal Dan Burch said he would be disappointed if the charges are found to be true. He would not discuss the students' background, though some newspapers have said, quoting students, that both belonged to affluent families.

"I cannot even tell you about their parents and I cannot even recall their first names right now," Burch said. "I always called them Mr and Mrs Khan, Mr and Mrs Singh".

"The charges that have been filed against these students are very serious. We place a high priority on protecting the integrity and confidentiality of our student data systems, and any potential breach of these systems is a serious concern," he said.

Khan might not have been caught immediately had he not been accused of cheating in his English class on a test in mid-April this year. The teacher who caught him gave him a failing grade, and handed over the test to the assistant principal. Over that weekend, Khan allegedly broke into the locked office of the assistant principal and stole the test back hoping to conceal the evidence.

A few hours later Khan, who was planning to apply again to a few universities, reportedly requested a copy of his official transcripts. He was also planning to appeal a denial of admission to the University of California, officials say. The same night, Khan allegedly broke into the school again, changed additional grades, and backdated the date and time stamp to cover up his crimes.

Khan, who was arrested last week, was released on $50,000 bail while Singh, who surrendered to the authorities, was freed on his own cognisance.