NAIROBI, Kenya — Kenyan forces claimed on Friday to have captured Kismayu, the last major stronghold of the Shabab militant group in Somalia, which, if confirmed, could spell an end to the Shabab’s ability to control large tracts of territory and mark the beginning of an underground, and possibly just as dangerous, guerrilla phase.

Kenyan officials said their troops had staged a daring midnight amphibious assault to storm the beaches of Kismayu, a vital port for the Shabab, with Somali allies in the boats alongside them.

“Operation Sledge Hammer executed as planned,” wrote Maj. Emmanuel Chirchir in a Twitter message on Friday morning. “Kismayu falls and under control.” He added: “All forces in good shape and spirit.”

Casting confusion over the outcome, the Shabab claimed not to have withdrawn and even bragged on Friday about destroying armored vehicles of the Kenyan Defense Forces.