An undercover FBI agent posing as a real estate developer provided the “Hamilton” ticket that Tallahassee Mayor Andrew Gillum used to see the Broadway show in 2016, according to text messages made public Tuesday that appear to contradict the Florida gubernatorial candidate’s previous statements.

A lawyer for Tallahassee lobbyist Adam Corey turned the messages, emails and other documents over to the Florida Commission on Ethics in response to a subpoena and sent them to news outlets. The commission is investigating whether Gillum, a Democrat, paid his own way on trips with lobbyists to New York and Costa Rica.

For more than a year, Gillum has faced questions about those trips and about a federal public-corruption probe in Tallahassee, the precise contours of which are not known. Gillum, who polls show holds a narrow lead over Republican Ron DeSantis, has said that he did nothing wrong and that the FBI told him in June 2017 that he was not a “focus” of its investigation.

“The question is, did you pay for the ‘Hamilton’ ticket, or did the undercover FBI agent pay for the ‘Hamilton’ ticket?” DeSantis asked Gillum at a debate Sunday.

“I don’t take free trips from anybody,” Gillum responded. “I’m a hardworking person. I know that may not fit your description of what you think people like me do. But I’ve worked hard for everything that I’ve gotten in my life, and I don’t need anybody handing me anything for free.”

The text messages and emails show how Corey, a longtime friend of Gillum’s, helped arrange outings in New York in concert with “Mike Miller,” a purported real estate developer seeking to do business in Tallahassee. He is now widely believed to have been an FBI agent working undercover in a probe that has examined the city’s Community Redevelopment Agency.

Gillum has not been accused of wrongdoing, and no arrests have been made. The FBI declined to comment.

Gillum traveled to New York in August 2016 on business for his former job with the People for the American Way Foundation, the charitable arm of a liberal advocacy group. While he was there, he met up with a group including Corey, Miller and his brother Marcus Gillum.

Text messages between Corey and Miller show that planning for the trip began weeks in advance, as Miller sought to arrange hotel rooms, a catered cruise and a trip to a Mets baseball game. The night before the ballgame, Miller wrote to Corey that the weather forecast looked poor.

“Maybe a show instead? Have you seen Hamilton?” Miller wrote.

“That would be epic!!!!!” Corey replied.

Corey gave Andrew Gillum the news in a text message at noon that day, saying that “Mike Miller and the crew have tickets for us for Hamilton tonight at 8 pm.”

“Awesome news about Hamilton,” Gillum replied.

In an interview Tuesday on MSNBC, Gillum dismissed the newly disclosed documents.

“Today’s news was no news for us at all,” he said. “I always knew that if we were able to connect in New York, we would go and see ‘Hamilton.’ When I got to the theater, my brother handed me the ticket. The idea that I accepted a gift never came to me.”

His campaign said in a statement that the documents vindicate Gillum, but a spokesman declined to answer follow-up questions.

Florida law prohibits elected officials from accepting any gift worth more than $100 from a lobbyist or vendor doing business with the city. Those rules, however, do not bar gifts from family members and do not require that such gifts be reported.

Reporters started asking questions about the Hamilton tickets a year later, in August 2017. Gillum refused to answer those questions until August 2018, when he told The Washington Post he had received the ticket from his brother Marcus. Gillum said that initially he assumed Marcus had paid for the ticket, and that he learned later that Corey had given it to Marcus in exchange for a ticket to a Jay-Z show. No ticket exchange or Jay-Z show is mentioned in the documents made public Tuesday.

The documents also shed new light on the arrangements in Costa Rica in May 2016.

Corey fronted the money for lodging at a luxury villa, and emails with his accounting firm indicate that he charged $8,868 on a credit card for the trip.

Corey’s firm, Unconventional Strategies, considered the trip a “client development retreat,” and Gillum and his wife owed a total of $941.95 in reimbursement for lodging, transportation and meals, according to the emails. On a list of people who owed the firm a reimbursement, Gillum’s name and his wife’s were crossed out, along with a notation: “HOLD ON BILLING.”

In September, Gillum produced receipts showing that he and his wife paid for their airfare. He has said he paid his portion of the lodging costs in cash, showing as evidence a receipt for an ATM withdrawal of $400.

Chris Kise, Corey’s lawyer, has said Gillum never reimbursed his client for the Costa Rica trip.

Kise said that his client received the ethics commission’s subpoena on Oct. 15 and that he released the documents Tuesday because they would have become public eventually anyway.

In a statement, Kise said that Corey had been “unfairly and inaccurately portrayed in the media as being engaged in improper or criminal actions” and hoped that disclosure of the records would show he did nothing wrong.