San Francisco's Pier 38 at the foot of Townsend Street, home to dozens of technology startups and two venture capital firms, has been red-tagged as unsafe by the San Francisco Port Authority, which is evicting all the tenants on Sept. 30.

"Any other city would want to help this jewel of a technology hub that has a worldwide reputation and has produced millions of dollars of investments," said Ken Thom, managing director of SOMAcentral, which rents out flexible, low-cost space at Pier 38 to about 50 small firms and about 200 workers. "It is mind-boggling that they are going to close it down because of small building-code violations that we are perfectly willing to take care of."

But the port says the structural issues are severe.

"Our chief harbor engineer and inspectors found that a significant amount of construction was performed without inspection or approved construction plans" at the pier, said Renee Dunn Martin, spokeswoman for the port. "There were significants concerns with plumbing and electrical violations. They determined that the pier was hazardous and unsafe."

She said the pier must be vacated by the end of the month to allow repairs, "which will probably take a year or more."

The pier's primary leaseholder is developer Carl Ernst, who sublets to Thom and other tenants. Ernst signed a 20-year lease on the dilapidated property in 1996, hoping to create a maritime recreation center with a focus on mega-yachts. That never came to pass, and his relationship with the port has deteriorated amid lengthy lawsuits.

"I'm 70 years old, and I've lost everything," Ernst said. "I had my entire life savings wrapped up in the development. I've lost about $6 million. My life has been completely shattered. These maniacs even had me thrown in jail."

In May, port officials alleged Ernst had threatened their lives. He was arrested and pleaded not guilty. All charges were subsequently dropped. Ernst said a drunken acquaintance trumped up the allegations.

Ernst charges that the port has blocked his attempts to get permits for renovation; refused to give him rent credits for improvements he made; and failed to maintain the roof, walls and other areas it had agreed to under the lease.

The port, in turn, says he is several years behind in rent, and his renovations were shoddily done. "It's been an ongoing nightmare," Martin said.

Things came to a head this summer when the port won an unlawful detainer lawsuit against Ernst, allowing it to proceed with inspections and evictions.

Martin disputed the contention of Ernst and some tenants that the eviction is being done to make way for America's Cup activities.

For the scores of tenants, the Byzantine back story doesn't matter as much as losing their work space.

"This is a fabulous location with just the right vibe for how we represent ourselves to the tech community," said Phil Black, managing partner at True Ventures, a VC firm that became the pier's first tech tenant in August 2006.

"We've had a snowball effect of numerous companies and like-minded folks who wanted to be here," Black said. "It's a real shame that so many small startups will be looking for space. There is a lot of space out there, but it's much more expensive than two or three years ago."

Another tenant, Rob Abbott, CEO of Egg Haus, which builds mobile and tablet apps for large brands like AOL, Disney and eBay, said: "It's disruptive that we're losing our home and have to move. We have a lot of clients and will have to shift our entire work life elsewhere."

But, he added, "Lots of landlords, incubators and startup housing have offered space to us and the other folks here at the pier."

Polaris Venture Partners runs the Dogpatch Labs incubator at Pier 38, which hosts about 20 of its portfolio companies at any one time. "We've had over 250 entrepreneurs come through here representing over 100 companies," said principal Ryan Spoon. "They have received seed financing and venture funding of over $100 million. It's been really successful. This is a very unique place, but Dogpatch Labs is not a physical thing, it's an atmosphere, community, vibe."

Thom is opening a space at 1 Market Street that he hopes will be ready by Sept. 30. It has enough space to accommodate all his current tenants, he said.