Imagine every off-color text message and ill-considered joke you’ve ever sent a friend was scooped up by authorities and used against you as evidence of a serious crime.

That’s what a group of Air Force pilots have accused their commanding officers of doing in an investigation that could wreck the pilots’ careers. And the strangest part: These allegations of drug use were based solely on a series of text messages—texts that often were little more than quotes from the lyrics of rappers and professionally naughty pop starlets.

The case has lawmakers on Capitol Hill questioning whether Air Force commanders overstepped their legal authorities and punished the men to cover up their own misguided investigation. And the pilots’ dilemma is a cautionary tale about contemporary notions of privacy, and a reminder that messages someone never meant to be made public can be used against him with devastating results. Especially if Miley Cyrus is involved.

In cavalier and often profane exchanges, the four pilots, who are stationed at Laughlin Air Force base in Texas, one of the service’s main pilot training centers, boasted about using various drugs, including “molly,” or ecstasy, and marijuana.

Some of the pilots texted about a trip to Las Vegas in which Cyrus’ “We Can’t Stop” became a sort of text motif after they heard it playing on the radio.

She sings: “So la da di da di/We like to party/Dancing with Molly/Doing whatever we want.”

“Molly” became shorthand for the wild bro-weekend in Vegas, which one of the accused later swore was drug free. It also became a kind of inside joke to make fun of a group of girls the men ran into who they thought were high on drugs.

“I can’t imagine a scenario in which a group of Air Force officers would be texting about engaging in criminal acts if that’s what they actually had done,” one of the pilots later wrote his commanding officer. “Maybe I’m naive in this regard, but it makes no sense to me.”

In other texts, the pilots laughed about getting high on prescription medication and “popping pills” and “smokin’ bud.” Some messages were by turns lewd and juvenile. (Air Force pilots have a long history of talking like, um, sailors.)

One pilot, while attending a wedding, texted his colleague who was serving as best man, encouraging him to come to hit the town after he’d fulfilled his wedding duties and “bring you[r] bridesmaid bitches.”

These were undeniably stupid things for Air Force officers to say—a fact the pilots readily acknowledged when pleading for leniency. But read in the context of the many other messages the pilots sent each other, their words could be seen as nothing more than the type of casual, ironic banter that friends—particularly male friends—use when communicating over their phones. The messages are flippant and embarrassing. Are they evidence of a crime, really?

“As anyone who is not tone-deaf to popular culture would readily recognize, ‘let’s pop some pills’ is a phrase used in rap songs,” a legal counsel to one of the pilots wrote investigators to explain the use of a line from “Pop Another Pill” by JellyRoll. The texts also reference songs by rappers Warren G. and T.I., the singer Miley Cyrus, and the movie Wedding Crashers.

Other text messages, the counselor writes, “echo rap lyrics and quotes from popular [television] shows such as Eastbound and Down. To think that the use of such language is indicative of drug use makes zero sense.”

Three of the pilots have been stripped of their wings and now have blemishes on their records that could well end their Air Force careers and make it less likely that they’ll be able to get jobs as commercial airline pilots.

The men say they never meant their messages to be read literally and that they don’t take illegal substances. They have passed drug-screening tests. One of the pilots is a Mormon who doesn’t use alcohol and says he rarely drinks caffeinated beverages.

The Daily Beast has reviewed evidence from the pilots’ cases, including copies of text messages that investigators say prove the men were using drugs. The Daily Beast has also examined sworn statements from the pilots, letters from characters witnesses, and the results of drug tests that showed the men tested negative for any illegal substances when the investigation began last summer. This article is based on those documents and interviews with legal experts as well as five people involved in the case and who asked to remain anonymous for fear the Air Force will retaliate against the pilots.

Congressmen Duncan Hunter and Adam Kinzinger, both military veterans, sent a letter to the Air Force chief of staff on Tuesday demanding to know why the service had meted out what they called “excessive punishment” against the young pilots based solely on text messages that showed “no evidence of drug use” and were clearly joking in nature. The congressmen also asked on what legal grounds the Air Force confiscated and searched the men’s personal cellphones, as well as why the service used so-called non-judicial punishments that have deprived some of the men from a public hearing where they might exonerate themselves.

The Air Force insists the texts are at the very least evidence of bad judgment and behavior unbefitting an officer. “It goes without saying that the Air Force demands integrity and professionalism be at the center of all its airmen’s lives,” Colonel Kirsten Reimann, a spokesperson, told The Daily Beast. “They encompass who we are as a service, how we conduct ourselves both on- and off-duty, and define the high standards to which we all are expected to adhere.”

Were the men brought up on charges of conduct unbecoming an officer, they might well have been found guilty.

But most of them never saw the inside of a military courtroom. One pilot availed himself of his right to a public hearing, under the Uniform Code of Military Justice, and in a proceeding that lasted only two hours refuted the evidence against him. He was exonerated and returned to flying duty.

The remaining three men were confident that they, too, would be able to defend themselves in a public hearing. But instead, the Air Force chose to serve them with letters of reprimand, a serious form of admonishment that requires a commanding officer only conclude that the preponderance of evidence shows guilt. Unlike a court martial, the military equivalent of a civilian criminal trial, the burden is not on the accusers to prove guilt beyond a reasonable doubt.

The letters of reprimand state that the men used illegal drugs, and offer only snippets of text messages as evidence. Those letters will stay in the pilots’ personnel files for years and serve as a kind of black mark that, if not erased, could keep them from flying again.

The commander at Laughlin Air Force Base, Colonel Brian Hastings, who signed the letters, pointed to exchanges about consuming drugs, their effects, and apparent attempts to score more pills.

In one exchange, a pilot joked about overdosing on ecstasy, but later explained that he merely meant to evoke memories from the trip to Las Vegas and a running commentary about hedonistic partying. One message was signed #sorryimnotsorry, a well-worn Twitter hashtag that investigators seem to have interpreted as a defiant confession.

In another exchange, a pilot texted a colleague that he should bring some food to grill for a large cookout at the man’s house.

“You got the Molly,” the friend texted.

“You know what it is,” the host replied.

Based on that two-line exchange, the host pilot was accused of distributing ecstasy and eventually grounded, a punishment that can derail a young pilot’s career.

Yet another pilot carried on an extended text conversation about molly with a woman he was trying to impress so that she’d sleep with him. In the texts, he claims to know the effects of the drug, implying that he’d taken it, as she previously had. But he later said he hadn’t really taken ecstasy, a claim that the woman herself backed up in a written statement to investigators attesting to the pilot’s strong character and the pride he took in serving in the Air Force.

The Air Force investigators who landed on the four pilots didn’t set out looking for drug dealers and pill poppers. Their initial target was a pilot instructor at Laughlin who was accused of having an inappropriate relationship with a student.

Last summer, investigators seized the instructor’s cellphone looking for evidence of the relationship. They found drug-themed texts that he had sent to another pilot. That put the investigators on a new trial, which ended in the seizure of the four other pilots’ personal cellphones.

In at least one instance, it’s not clear that investigators had the proper legal authority to search one pilot’s phone. A copy of a search warrant authorizing investigators to look through its contents was dated one day after the search was conducted. (A warrant is supposed to be obtained before any search.) The warrant allowed investigators to examine virtually all the contents of the phone, including text messages, saved and deleted photos, emails, Internet activity, and call logs.

It’s not clear from the document whether the warrant was obtained entirely after the search was conducted, or if it was in process at the time.

Hunter and Kinzinger, the lawmakers probing the case, have asked for a fuller explanation of all the legal authorities the Air Force used. “At this time it is our firm belief that the Air Force had no grounds to proceed with the charges against the pilots involved,” the congressmen wrote to Air Force Chief of Staff General Mark Welsh. “The Air Force may not like showboating of any kind, even among its pilots,” they said in regards to the text messages, “but to think that could be considered criminal, especially in the absence of evidence that a crime occurred, severely undermines the integrity of the Air Force’s investigation process.”

Ultimately, Hastings, the pilots’ commander, had nearly unilateral authority to punish the men or let them off with a lesser warning. The decision to issue the letters of reprimand was his alone.

A spokesperson for the Air Force said Hastings had moved on to another position and is no longer at Laughlin.

All four of the accused pilots were well-regarded officers. Three scored so highly in their pilot training that they were invited to come back as trainers, a designation known as First Assignment Instructor Pilot. The position is both an honor and a major career booster for young pilots. Many current generals were FAIPs when they started out in the Air Force.

Grounded for the past several months while they appeal their punishment, the pilots have been unable to log flight hours. If they’re allowed to fly again, they’ll have a deficit that will make them less competitive for future assignments, both in the Air Force and as commercial pilots. At least one pilot is also fighting the Air Force’s attempts to discharge him. A less than honorable discharge from the service would almost certainly disqualify him from work as a commercial pilot.

The three pilots are now in limbo, relegated to desk jobs, for which they’re still being paid.