Paxton has been a longtime ally and supporter of Trump. Just last month the Texas Republican tweeted a photo of himself golfing at Mar-A-Lago with Trump, whom he called his "favorite" president.
In the lawsuit filed in the Northern District of California on Monday, Twitter said the legal action was to stop Paxton from harassing the company in retaliation for its content-moderation decisions he may disagree with.
"Twitter seeks to stop AG Paxton from unlawfully abusing his authority as the highest law-enforcement officer of the State of Texas to intimidate, harass, and target Twitter in retaliation for Twitter’s exercise of its First Amendment rights," the suit states. "The rights of free speech and of the press afforded Twitter under the First Amendment of the U.S. Constitution include the right to make decisions about what content to disseminate through its platform."
The court documents state that Twitter decided to suspend numerous accounts "for violating its policies against glorifying or inciting violence, and against manipulating or interfering in elections or other civic processes," in the wake of the Jan. 6 insurrection attempt at the Capitol building. Trump's account was among those Twitter permanently suspended in the aftermath of the violence
Five days after Twitter suspended Trump's account, Paxton issued a civil investigative demand to Twitter "seeking volumes of highly confidential documents concerning Twitter’s internal content moderation processes -- the public disclosure of which would undermine their effectiveness, and compromise Twitter’s ability to effectively and efficiently moderate content on its platform," the court documents claim.
The company said it sought to reach an agreement with Paxton for weeks to no avail.
"Instead, AG Paxton made clear that he will use the full weight of his office, including his expansive investigatory powers, to retaliate against Twitter for having made editorial decisions with which he disagrees," the complaint alleges.
Paxton's office did not immediately respond to ABC News' request for comment Tuesday.
Paxton issued the initial civil investigative demand to Twitter on Jan. 13, as well as to fellow tech giants Google, Facebook, Amazon Web Services and Apple. In a statement at the time, he accused the companies of "coordinated de-platforming" of Trump.
"First Amendment rights and transparency must be maintained for a free online community to operate and thrive. However, the seemingly coordinated de-platforming of the President of the United States and several leading voices not only chills free speech, it wholly silences those whose speech and political beliefs do not align with leaders of Big Tech companies. Every American should be concerned about this large-scale silencing and the effects it will have on the future of free speech," Paxton said.
The attorney general added at the time he thinks the "public deserves the truth about how these companies moderate and possibly eliminate speech they disagree with."
In the complaint, Twitter argues, however, that as a private firm it has the right to make decisions about what content to disseminate on its platform.
Facebook previously said it suspended Trump’s account citing the risk of Trump using the platform to incite violence in the wake of the deadly Capitol riot.
Apple, Google and Amazon Web Services have said they removed Parler, a platform popular among right-wing users, for violating policies and not removing posts that incite violence.
"More likely: companies came to their own conclusions or were emboldened by the actions of others," Dorsey said in a Tweet.