CENTRAL FALLS, R.I. — They would seem, at first glance, to have nothing in common: the small, struggling Rhode Island city of Central Falls
and A-list Hollywood actor Alec Baldwin.

Central Falls is the city that declared bankruptcy three years ago, watched its mayor plead guilty to corruption, and became a symbol of government gone wrong. Baldwin is the actor who issued a dramatic “goodbye to public life” earlier this year, after his escalating conflicts with aggressive tabloid photographers led him to be accused of homophobia.

Somewhere in the midst of their own very public ordeals, the actor and the municipality found each other — and found common ground — in a quest to protect a public library from shutdown.

Baldwin, who donated $15,000 to the Central Falls library in 2011 and 2012, stood on the front steps of the small brick building Saturday afternoon and accepted the key to the city from Mayor James Diossa. “You believed in us, Alec, and we appreciate it,” Diossa told him.

Get Fast Forward in your inbox:

Forget yesterday's news. Get what you need today in this early-morning email.

A native of Amityville, N.Y., and the son of a social studies teacher, Baldwin, 55, spoke about the enduring role of libraries. “Even though the technology has changed how we consume material . . . libraries are still very important in the life of the community,” he said. “Me, I still like to carry a book around.”

Then he headed inside for a VIP reception with Rhode Island’s governor, Lincoln Chafee, and about 100 library supporters who had donated between $500 and $5,000 each.

The main walkway outside the building was decked out with a swath of bright red carpet, while inside, the library’s checkout counter was transformed into a wine bar for the occasion. A French restaurant in Providence, Chez Pascal, provided fancy hors d’oeuvres including asparagus panna cotta with bacon jam and rhubarb compote and marinated beets with smoked bluefin mousse.

The festive atmosphere was a far cry from the mood three years ago, when a state receiver took control of the city’s ruined finances and swiftly shut down the library to save money. It remained closed for just one month: A determined coalition of supporters refused to let it go quietly, and took over running the place on a purely volunteer basis.

They hung a banner outside, proudly declaring, “Welcome to YOUR library.” A loophole made the residents’ takeover possible; the Adams Memorial Library building is held by a private trust, not owned by the city.

When a story about the library’s plight appeared in The New York Times, Baldwin read it and sent $10,000 to help. He sent $5,000 the next year, and also helped out the highly ranked chess team at Central Falls High School. (Hollywood actress Viola Davis, who grew up in Central Falls, has also supported local schools, and persuaded Meryl Streep to do the same, said city officials.)

The high-profile help drew headlines, which spurred other donations. In time, the library was able to rehire a few paid staff members. It is still a lean operation, but it opens six days a week.

Joel Pettit, the library’s director, wrote a letter to Baldwin to ask if he would headline a library fund-raiser this year, and he agreed. The city hoped to raise $100,000 over the weekend with the reception and a larger event, a program of dramatic readings, in Providence, and has tentative plans to transform an unused Victorian house on the library property into a modern media center.

It is an example of a confident, creative new way of thinking about the future here, an approach that city leaders — many of them, including the mayor, still in their 20s — describe as “Government 2.0.”

Baldwin, coincidentally, played a working-class father in the movie “Outside Providence.” His attempt at a Rhode Island accent was unconvincing, and his battles with the tabloids have fired controversy, but in this blue-collar spot, population 19,000, he has won residents’ respect.

“You would think he would go to Newport, but instead he comes here, to the tiniest, poorest place in the state,” said Andrew Shotts, 44, owner of Garrison Confections in Central Falls. “That says a lot.”

Shotts also approves of Baldwin’s feisty attitude, when dealing with critics on Twitter or with the NYPD, which arrested him last month for riding his bike the wrong way down Fifth Avenue.

“I’m like, ‘You go, man,’” said the local candy maker, whose handcrafted chocolate bonbons, filled with fruit-infused ganache, were among the delicacies served at the library reception.

Around town, many were aware that he was there, even if they weren’t sure exactly why. “I don’t remember what movies he’s in, but I think he’s handsome,” said April Castonguay, 37, sitting on the steps of the group home where she lives, across the street from the library.

Brian Perez, 24, was walking his dogs, Nino and Diamond, when he noticed police cars blocking the street and a TV truck parked near the library. He figured something bad had happened.

Surprised to learn it was something good instead, he lingered to watch, keeping a safe distance in case the dogs started barking. (They did.)

Baldwin gave $250,000 to four libraries on Long Island in 2012, and recently donated $1 million more to build a new children’s wing at one of them. But in an essay in New York magazine in February, he lamented that such acts carry no weight in the public profile drawn by the media.

“In the New Media culture, anything good you do is tossed in a pit, and you are measured by who you are on your worst day,” he said in the essay.

Still, a pack of photographers showed up at the library to capture his good deed.