THOMASTON, Maine — Fred Rector and Warren Williams lived near each other in Thomaston for years, but until last week they were strangers who did not realize they had a shared experience of a famous World War II battle.

An acquaintance of the two men arranged for Rector, 93, and Williams, who is about to turn 97, to meet Thursday at the Episcopal Church of St. John Baptist in Thomaston and swap stories about the battle of Anzio.

The meeting was arranged by Peter Schiot, who lives across the street from Williams and sits behind Rector in church. When Schiot became aware the two men had been in the battle of Anzio, he suggested — and they agreed — to meet and share their stories.

Rector was a seaman first class who served as a striker for a quartermaster aboard a destroyer. This meant he would assist the officer on the deck of the ship. Williams was a machinist aboard a minesweeper, calling himself a “diesel jockey.”

The battle of Anzio lasted from January through May 1944, as Allied forces tried to break a stalemate in the Italian campaign. Anzio is on the west coast of Italy.

Rector was living in Needham, Massachusetts, when he enlisted in the Navy. Williams was from Maine, having lived in Bar Harbor as a youth.

The men recalled the constant nighttime bombings by German planes. Germans would shoot off fluorescent flares that would light up the night skies, allowing their planes to better spot the American Navy ships.

The German and Italian troops had burrowed themselves into their positions on land, Rector said, recalling how it took a lot of ammunition to loosen up their positions.

Rector said the worst scene he witnessed was when a Red Cross ship was struck by aerial bombing and the vessel sank almost instantly. He said rules of engagement called for Red Cross vessels to have safe passage, but that often was violated by the Germans.

“We heard cries for people who were in the water,” Rector said.

The captain of his destroyer planned to respond and rescue people from the Red Cross vessel and asked permission from the admiral who was aboard a cruiser the destroyer was escorting. The admiral of the battleship that was being escorted, however, ordered the cruiser to keep on its original course.

“He said our duty was an escort,” Rector recalled, because the destroyer had equipment to detect submarines while the cruiser did not.

For Williams, what sticks in his mind the most was the time his minesweeper had to pick up the bodies of men who died when their landing craft caught fire. Their mission was to carry the bodies out to sea for burial.

The crew removed the dog tags from the dead before the burial at sea. The burial was done at night during heavy bombing.

Both men said they talked little about the war after returning home. Neither joined veteran organizations when they left the service.

“This is probably one of the first times I could talk with someone in the Navy like myself,” Rector said.

Rector’s son, Chris Rector of Thomaston, attended Thursday’s meeting of the two veterans. He said he heard more about his father’s service at this meeting than he had ever heard before.

After Anzio, Rector was reassigned to the Aleutians Islands, where he served for six months.

Upon the completion of his service, Rector returned home and was asked by his father to help out at his wholesale food business in Boston. The younger Rector worked with his father for nine years before taking over the business. When the Boston Redevelopment Authority revamped the region, Rector decided not to seek a new location for his business and moved to Maine to work for a paint and wallpaper business in Camden. That business closed six weeks after he took the job.

Rector then started his own businesses in 1971, the Pine Tree Shop and Bay View Gallery. He is now retired.

Williams had lobstered before he joined the Navy but said he had no interest in doing that after the war, referencing a World War I song “How Ya Gonna Keep ’em Down on the Farm (After They’ve Seen Paree?).”

After the war, he went to Bates College in Lewiston, then completed his education in agriculture at the University of Maine. He worked in food processing plants before returning to the sea, where he served as a merchant mariner and went aboard a research vessel for the University of Rhode Island. He and his wife, Harriet, have been married since 1946.

The two veterans said they would be interested in meeting each other again to continue sharing their war experiences.