Back when Gary Goodman first got into the used books business, he admits, he knew nothing about running a bookstore.

At the time, he was seeking respite from his work as a counselor in a psychiatric unit.

Now, 27 years after opening St. Croix Antiquarian Booksellers on Main Street in Stillwater, Goodman is once again seeking a change: retirement. The longtime used and rare bookstore is closing at the end of July.

“It helped me put six kids through college,” he said on a recent morning, as customers browsed the aisles looking for bargains. “But it’s a tough business, especially in this day and age.”

For the past few months, the store — one of the last in the Twin Cities metro to specialize in rare books — has been shedding inventory and winding down.

Internet giants such as Amazon, and a general shift to buying and downloading books to tablets and other electronic devices, has made what had always been a competitive business even tougher to sustain, Goodman said. Paying a property tax bill of about $15,000 a year on the building and his store’s 4,300 square feet makes it even tougher.

Still, he said, “It’s been a great store.”

You can consider Goodman an accidental bookseller.

He was a 30-year-old counselor on the night shift of a psychiatric residence when, he said, a nurse discovered that patients were plotting to kill the night staff. “At that point, I thought, ‘There’s no future in a job where people are trying to kill you,’ ” Goodman said.

It was his wife who spied a used bookstore for sale on the East Side of St. Paul.

“She came home and told me, ‘You should get down there,’ ” he said.

With no money, and no background in books, Goodman said he negotiated with the owner to buy the store with no money down and a monthly payment of $100. It took him several years of on-the-job training to figure out that many of the books in the store weren’t worth even the little he was paying. After several years, he sold the place and joined forces with a pair of partners to open Antiquarian in Stillwater in 1990. He has been the sole owner since 2001.

At the time Antiquarian opened, there were dozens of independent rare and used bookstores throughout the Twin Cities. Now, he said, there are only Antiquarian and Midway Bookstore in St. Paul. A local businessman has bought the building, although Goodman will not say who or for how much.

One day last week, several customers came in to look over Goodman’s collection, including 1874 prints of St. Paul, Minneapolis and Winona priced at $600 each. Among the store’s rare books are a 1913 copy of “Poems” by Robert Louis Stevenson, which Goodman expects to sell for $15,000 or so.

Over the past few months, Goodman’s inventory has shrunk from 30,000 books to 18,000. He plans to keep 3,000 to 4,000 to sell online, donating the rest.

“I can’t tell you how many people have come in and are just upset that we’re closing,” he said.

Even in the store’s last days, its challenges are evident. One woman, her arms full of books, admitted this was her first time in the store. She buys online.

A mother and daughter, Teresa and Abigail Pederson, shopping for Abigail’s 20th birthday said that while they love books and the history of Antiquarian’s collection, they usually patronize the library.

“I’m on computers all the time,” said Abigail, a college student majoring in computer science. “I like having something to hold.”

Even with the challenges, Goodman said there are things he’ll miss.

“I’ll miss buying the books,” he said of a job that used to take him across the U.S. and Canada to find rare volumes. “And I’ll miss the people — the book people.”