Donald Trump keeps the world on edge with his Twitter squawks. But now, his 140-character missives are coming back to haunt him.

On Dec. 7, 2015, the president of the United States sent a tweet that now feels darkly foreboding. It was titled a "Statement on Preventing Muslim Immigration" and attached was a link to a radical, nearly unimaginable approach to U.S. immigration policy: a clear call to totally exclude one specific religious group.

"Donald J. Trump is calling for a total and complete shutdown of Muslims entering the United States," the first line of his statement read. Since then, he signed an executive order attempting to prevent people from seven Muslim-majority countries from entering the country.

It makes sense that Trump launched that infamous 2015 announcement on Twitter. After all, he's a president known for 3 a.m. Twitter ramblings and printed-out tweets at press briefings. But now, those pithy rants — and the motivations behind them — have become his undoing in court.

As the executive order, currently on hold by judicial ruling, is dragged through the courts, Trump's tweets have become an invaluable weapon. His 140-character statements and the documents he shares on Twitter have been submitted as evidence to show the travel restrictions are indeed a thinly veiled Muslim ban.

Showing his true motivations

In more than 20 legal cases filed against the ban, lawyers have tried to demonstrate a "desire to harm Muslims" through the words Trump taps out on his favorite social media platform, in addition to statements made on television and in press releases.

Image: VICKY LETA/MASHABLE

On Monday, a federal appeals court judge in Virginia ruled that Trump made it clear he wanted a Muslim ban. The first bit of evidence listed in Judge Leonie Brinkema's decision was the "statement on preventing Muslim immigration" that Trump tweeted back in December 2015.

A case in California, filed by attorneys with the American Civil Liberties Union, submitted that tweet as well as another one as evidence.

The other tweet showed Trump saying the immigration ban is "about keeping bad people (with bad intentions) out of the country." Although that one doesn't directly mention Muslims, lawyers argue it still shows religious discrimination.

Everybody is arguing whether or not it is a BAN. Call it what you want, it is about keeping bad people (with bad intentions) out of country! — Donald J. Trump (@realDonaldTrump) February 1, 2017

The first tweet above made no mention of terrorism or national security — the very things the Department of Justice has argued in court are the reasons for the ban. It only verbalized a clear desire to keep out an entire religious group.

"His tweets are relevant for interpreting the executive order," said Novella Coleman, an ACLU attorney who worked on the California case, because they help "determine whether or not his actions are motivated by an unlawful discriminatory purpose."

"His tweets are relevant for interpreting the executive order."

Trump's tweets show him discriminating against Muslims regularly, unabashedly and publicly, Coleman said.

"Usually when the decision-makers are acting on an unlawful discriminatory purpose, they don't usually articulate that so frequently and so publicly," she said.

And since Trump loves using Twitter to explain his policy plans, Coleman said, his tweets are relevant and totally fair game. "It's definitely part of the history of the executive order," she said.

A long history of concerning tweets

Back when Trump wrote that tweet about "preventing Muslim immigration," he was just a long-shot presidential candidate, a famously brash New York City real estate tycoon and reality TV star with a distinct orange-y hairstyle — a man who many saw as lightyears away from actually winning the presidency.

His words were headline-grabbing and alarming while not seemingly realistic. But just over a year later, he tried to add teeth to those inflammatory promises. And it's on Twitter where Trump has really let loose, where he's launched attacks against Muslims freely and without shame.

A little over three years ago, Trump repeatedly slammed the construction of a new mosque in New York City, near Ground Zero, tweeting: "It is wrong." He has tweeted unverified, sensational claims about "militant Muslims" burning flags after 9/11, offering no evidence of those accusations. And he has repeated those claims tweet after tweet.

He's also tweeted attacks on Islam involving former President Barack Obama, painting Obama as sympathetic toward terrorists while simultaneously suggesting all Muslims are terrorists and Christians are in need of protection.

"@TheBrodyFile: On the Muslim issue: It might help @BarackObama if he actually supported Christians religious liberty rights. — Donald J. Trump (@realDonaldTrump) September 21, 2015

His tweets about "Islamic terrorism" have included suggestions for "a watch list" — a vague policy idea he further explained on Fox News in November: "But what I want is a watch list. I want surveillance programs," noting he actually wants a specific database for Syrian refugees.

And while there are statements of sympathy for Christians in the Middle East, Trump offers no such condolences to Muslim victims of violence in the region. He promises to accept persecuted Christians into the U.S. but not other refugees.

Christians in the Middle-East have been executed in large numbers. We cannot allow this horror to continue! — Donald J. Trump (@realDonaldTrump) January 29, 2017

The immigration order doesn't target all Muslims — there are dozens of Muslim-majority nations not included — and it never mentions the word "Muslim," but it can still be discriminatory.

"A tweet is just a statement, and it’s a statement by a person that’s identifiable and it can be used against the person."

A law can look unprejudiced on its surface and still discriminate against people, according to Adam Winkler, a professor of Constitutional law at UCLA.

"Just as [the courts] won't allow clear and straightforward racial discrimination, they also won’t allow hidden or covert discrimination," said Winkler said, noting this hidden motivation may be seen through Trump's tweets and "that’s why they’re relevant."

And just as tweets have been referenced as evidence before, they probably will continue to be. "A tweet is just a statement, and it’s a statement by a person that’s identifiable and it can be used against the person," Winkler said.

But all the Twitter digging may not matter. On Thursday, the Trump administration said it would create a new executive order rather than continue to fight in court, a pivot from Trump's all-caps threat a week earlier that led to a Twitter joke dogpile.

SEE YOU IN COURT, THE SECURITY OF OUR NATION IS AT STAKE! — Donald J. Trump (@realDonaldTrump) February 9, 2017

But if the next executive order gets taken to court too, it's clear lawyers will start combing Twitter again. That's where Trump squeezes his brash, questionable views into the clearest terms.