Basically they got cut off.
There is an interesting lake in my country, Lake Taal its actually a Caldera of an active volcano that used to be connected to the sea. A few centuries ago in recorded history an eruotion cased it to be blocked from the sea.
Saltwater fish eventually evolved to survive the lake.
https://www.cntraveler.com/stories/2013-01-21/taal-lake-luzon-philippines-maphead-ken-jennings
Latest Answers