MEXICO CITY — Nicaraguan lawmakers moved one step closer to fulfilling a national dream on Thursday, granting a Hong Kong company the right to build a $40-billion cross-country shipping canal that could compete with the Panama Canal — if it is ever built.

Experts say that while the approval process led by President Daniel Ortega has been swift, environmental opposition, changes in shipping patterns and construction costs could easily thrust the proposal onto the large list of discarded plans for a Nicaraguan canal.

“It’s not going to happen, that was my first reaction,” said Noel Maurer, an associate professor at the Harvard Business School who helped write a book about the Panama Canal. “A pipe dream might be too strong, but I would just consider it a really bad investment.”

The challenges for Nicaraguan canal planners have always been enormous, and the current project is nothing if not ambitious. It would entail slashing through around 180 miles of thick tropical terrain — roughly triple the length of the Panama Canal — and then pumping a virtual sea through a series of locks deep enough for massive cargo ships.