Former FBI general counsel James A. Baker has landed a role as deputy general counsel at Twitter Inc. amid the San Francisco-based social media company receiving heavy criticism from President Donald Trump.

Twitter's general counsel, Sean Edgett, announced in a tweet Monday night that Baker has joined the company's legal department. It is not clear where Baker will be based or when he starts his new role.

"Jim is committed to our core principles of an open internet and freedom of expression, and brings experience navigating complex, global issues with a principled approach," Edgett said in the tweet.

Baker and a representative for Twitter did not immediately respond to a request for comment on Wednesday. However, Baker responded to Edgett's tweet, thanking him for the opportunity.

"I'm very excited to join such a great team @Twitter doing such important work. Glad to be on board," Baker tweeted.

The move comes at a time when Twitter is facing criticism for adding fact-checking labels to the president's tweets. In May, Trump signed an executive order which would clarify the scope of immunity in section 230(c) of the Communications Decency Act.

Baker most recently served as the director of national security and cybersecurity at The R Street Institute, a think tank based in Washington, D.C. He has also recently served as a visiting fellow at Lawfare and at the Brookings Institution.

From January 2014 to January 2018, Baker served as the general counsel of the FBI. During his time there, he battled with Apple Inc. CEO Tim Cook, who made it difficult for the FBI to access the iPhone of the San Bernardino, California, shooter. However, in October, Baker said he believes the government must embrace encryption, even if it makes it more difficult to investigate criminal activity.

Baker was also involved in the Foreign Intelligence Surveillance Act warrant that led to the surveillance of former Trump campaign aide Carter Page in 2016. In January 2019, Trump mentioned him in a tweet discussing how unfair the FISA courts are.

"Former FBI top lawyer James Baker just admitted involvement in FISA Warrant and further admitted there were IRREGULARITIES in the way the Russia probe was handled," Trump tweeted.

Baker has also served as associate general counsel at Bridgewater Associates and as assistant general counsel at Verizon Communications Inc.