JOHANNESBURG—A Russian merchant ship whose owner has allegedly carried weapons for the Kremlin turned off its transponder last month before surreptitiously docking at South Africa’s largest naval base, where it delivered and loaded unidentified cargoes, according to witnesses and a senior U.S. official.

South Africa has declined to say what the ship was carrying or what was loaded onto it at the Simon’s Town navy base. The country’s defense minister shrugged off U.S. concerns, saying Washington “threatens Africa, not just South Africa, of having anything that is even smelling of Russia.”

The visit by the ship, the Lady R, owned by Russian shipping company MG-FLOT LLC, has strained relations between Washington and Pretoria. It also demonstrates the difficulty for the U.S. and its allies of enforcing sanctions against Moscow.

MG-FLOT didn’t respond to emails sent to addresses listed online seeking comment. The Russian Embassy in Pretoria and the Kremlin also didn’t respond to emailed requests for comment.

A senior U.S. official said Washington was concerned by the support the South African armed forces provided to the Lady R, including allowing it to enter and move cargo at a naval base while its automatic identification system was switched off.

For two nights, during which Simon’s Town was plunged into darkness by nationwide power cuts, a mobile crane moved crates off and onto the 122-meter-long vessel under the watch of armed guards, according to witnesses and photos viewed by The Wall Street Journal.

“There is no publicly available information on the source of the containers that were loaded onto the Lady R,” the U.S. official said.

The Lady R left Simon’s Town the morning of Dec. 9. When the ship started transmitting a position again in the evening of that day, it was anchored more than 100 miles east of Simon’s Town, tracking services showed.

Since mid-December, the vessel has been anchored off the coast of Mozambique, where it pulled into the port of Beira over the weekend, according to ship-tracking services, which give its destination as Istanbul. From Istanbul, it is a relatively short trip to Russian Black Sea ports.

Kobus Marais, a lawmaker and defense spokesman for South Africa’s opposition Democratic Alliance, said he was told that the Lady R delivered ammunition from Russia, although that would normally be imported through commercial ports, he said.

The U.S. imposed sanctions on the Lady R and MG-FLOT on May 8, when the company was using the name Transmorflot LLC. Washington said the company and its vessels had been shipping weapons for the Russian government.

In November, when the U.S. learned that the Lady R was headed toward South Africa, the U.S. Embassy alerted the South African government to the fact that the vessel was under sanctions, the senior U.S. official said.

Under U.S. law, Washington can sanction any entity, person or country that provides services to a sanctioned vessel.

The embassy received no response to its alert on the Lady R from the South African government, the official said.

Vessel-tracking services indicate that the Lady R switched off its automatic transponders, which relay a ship’s identity and position to other vessels and maritime authorities. Two South African navy tugboats helped it to a berth at the Simon’s Town base near Cape Town, according to witnesses.

Witnesses said they saw trucks with escort vehicles carrying shipping containers onto the base at night. One resident said she was chased down Simon’s Town’s empty streets after she tried to follow an empty truck leaving the base.

The ship’s cargo operations at the naval base occurred over two nights, witnesses said.

In a media briefing on Dec. 22, Defense Minister Thandi Modise said she was awaiting paperwork with more information on the shipment before she could comment on why the Lady R docked at the base and what was taken off and loaded onto the vessel.

“Whatever contents this vessel was getting were ordered long before Covid,” Ms. Modise said, before calling out what she said was unjustified U.S. pressure on African countries that maintained relations with Russia.

A spokesman for Ms. Modise didn’t respond to calls and messages seeking comment on the presence of the Lady R at the Simon’s Town base and the statements from the senior U.S. official. The South African armed forces also didn’t respond to requests for comment.

Darren Olivier, director of African Defence Review, a defense analysis and consulting company, said it was plausible that the Lady R was delivering an old order of ammunition from Russia. In 2020, South Africa authorized the import of 4.5 million rounds of Russian ammunition worth around $585,000.

It is less clear what could have been loaded onto the ship, Mr. Olivier said. “South Africa’s defense industry does not generally produce armaments and complete systems that are used by the Russian military,” he said. 

Russia could be interested in dual use items such as guidance and control systems and optics that could be used to produce aerial drones, Mr. Olivier said.

SHARE YOUR THOUGHTS

How should the U.S. respond to the Lady R’s stopover at South Africa’s largest naval base? Join the conversation below.

South Africa’s ruling African National Congress has close relations with Moscow dating back to the Soviet Union’s support for its fight against white-minority rule. Like many other African countries, South Africa has tried to take a neutral stance on the war in Ukraine. President Cyril Ramaphosa has held talks with both U.S. President Biden and Russian President Vladimir Putin since the war started.

In February, South Africa is scheduled to host a joint exercise with the Russian and Chinese navies.

MG-FLOT and several of its vessels have run into trouble with international authorities in the past. Another vessel owned by MG-FLOT, the Lana, was detained in April offshore Greece, according to Greek shipping authorities, which cited European Union sanctions on Russia. 

The U.S. then used a court order to confiscate part of the ship’s cargo, which Washington said has separately sanctioned oil from Iran. After Greek authorities released the vessel in exchange for two Greek tankers being held by Iran, the Lana delivered its remaining oil cargo to the Syrian government of Bashar al-Assad, according to shipping trackers.

In July, another MG-FLOT vessel was detained in Kochi, India, where it delivered munitions to the Indian navy, according to a court in Kochi. The vessel was detained after it allegedly failed to pay fuel bills to an Estonian company, the court said at the time.

Write to Gabriele Steinhauser at Gabriele.Steinhauser@wsj.com and Benoit Faucon at benoit.faucon@wsj.com