In the 18th century, Nantucket was the energy capital of the world. Ships departed the island, sailing to distant seas, hunting right whales for their oil.

On Tuesday, Nantucket is adding another page to the history books, as officials unveil a new energy source for the island: a giant battery. The battery will serve as backup for two insulated cables that run from Cape Cod to Nantucket, carrying the electric lifeblood that makes modern life on this timeless island possible.

The two electric cables come ashore at Galley Beach and run underground for a mile, beneath the tourist- and traffic-clogged streets of the historic district to National Grid's Candle Street substation.

Originally, coal was used to generate electricity for the island, then diesel fuel. The first electric undersea cable from the Cape was installed in 1996; the second in 2005. The changing technologies kept pace with the island's growth.

But now, Nantucket's population swells from 11,000 year-round residents to over 50,000 in the summer. And the median house price is $1.7 million.

"They're building big houses," says Karen Marsh, a lifelong Nantucket resident who works at National Grid's island headquarters. She says that the use of electricity more than doubles during tourist season.

"Demand is going up but I think we do a good job," she says. "We keep the lights on."

A segment of a cable that has transmitted electricity to Nantucket since 2005. (Bruce Gellerman/WBUR)

The two existing cables can handle the current load, even during the peak summer months. But the future of Nantucket's modern lifestyle hangs largely by those two threads — the undersea extension cords from the Cape.

"If we lost both cables, the island will go flat," says National Grid Project Manager John Skrzypczak. "There was a storm situation two or three years ago over the winter, and we lost the supply from Cape Cod and both cables went flat."

"Flat" means lights out for Nantucket.

To keep the lights on, National Grid had two, aging diesel generators on standby, installed in the late 1980s. When they reached the end of their lifespan, the utility replaced them with a modern diesel generator, which has a one-day fuel supply at the ready.

Over the next decade, National Grid predicts the demand for electricity on Nantucket will increase three times faster than the state average. To meet demand, the utility concluded the island would need a third undersea cable. Problem is, Nantucket residents are still paying off the first two. And undersea cables don't come cheap.

"Building a third cable — we're talking roughly about $200 million," says Terron Hill, National Grid's director of network strategy.

A segment of a cable that has transmitted electricity to Nantucket since 2005. (Bruce Gellerman/WBUR)

Hill helped devise an energy-efficient alternative — one that cost less than one-third the price and will buy the island time before installing a third undersea cable. It's a state-of-the-art battery energy storage system, "BESS" for short. And right now, it's the largest energy storage installation in New England.

Project Manager Skrzypczak says that BESS is made up of lithium-ion batteries — the same chemistry used in your cellphone. Think cellphone batteries the size of refrigerators. The 234 Tesla power packs are lined up in three long rows, storing backup electricity that can be fed onto Nantucket's grid. If Nantucket goes flat or loses a cable, BESS would kick in before the diesel backup.

"So if we lose one of the cables, we'll use energy storage that is a cleaner alternative to keep the island going," Hill says. "That's the main purpose of it — resiliency."

BESS can provide eight hours of electricity to about half of the 13,000 homes on the island, and can be recharged with the turbine diesel generator or undersea cables — when they're up and running.

Hill says National Grid considered using solar panels to recharge the batteries, but that wasn't feasible. "The footprint is a limiting factor here," says Hill. "You could do solar plus energy storage, but you would need a lot of land for the amount of capacity we need."

BESS buys National Grid time; the utility predicts it won't need to build a third cable for another 20 years or so. By then, there could be even better grid-scale batteries.

Hill says the future of energy storage is "bright" and could help pave the way for renewables like wind and solar. Across New England, there are 24 proposals to build battery storage systems. Total capacity: 500 times that of Nantucket's BESS. While it's likely that most of the projects won't get built, there is no doubt that batteries of all shapes and sizes will play a critical role in transforming New England's energy future.