diff --git a/src/Scripting/NasalFlightPlan.cxx b/src/Scripting/NasalFlightPlan.cxx
index a38eb1998..22c6d2994 100644
--- a/src/Scripting/NasalFlightPlan.cxx
+++ b/src/Scripting/NasalFlightPlan.cxx
@@ -632,6 +632,8 @@ static const char* flightplanGhostGetMember(naContext c, void* g, naRef field, n
         *out = naNum(fp->indexOfFirstApproachWaypoint());
     else if (!strcmp(fieldName, "destination_runway_leg"))
         *out = naNum(fp->indexOfDestinationRunwayWaypoint());
+    else if (!strcmp(fieldName, "totalDistanceNm"))
+        *out = naNum(fp->totalDistanceNm());
 
     else {
         return nullptr;
diff --git a/test_suite/unit_tests/Navaids/test_fpNasal.cxx b/test_suite/unit_tests/Navaids/test_fpNasal.cxx
index 94d2ec975..1b21bbe77 100644
--- a/test_suite/unit_tests/Navaids/test_fpNasal.cxx
+++ b/test_suite/unit_tests/Navaids/test_fpNasal.cxx
@@ -314,4 +314,21 @@ void FPNasalTests::testAirwaysAPI()
     )");
 
     CPPUNIT_ASSERT(ok);
-}
\ No newline at end of file
+}
+
+void FPNasalTests::testTotalDistanceAPI()
+{
+    auto rm = globals->get_subsystem<FGRouteMgr>();
+
+    bool ok = FGTestApi::executeNasal(R"(
+        var fp = flightplan();
+        fp.departure = airportinfo("BIKF");
+        fp.destination = airportinfo("EGLL");
+        unitTest.assert_doubles_equal(1025.9, fp.totalDistanceNm, 0.1, "Distance assertion failed");
+    )");
+
+    CPPUNIT_ASSERT(ok);
+
+    auto fp = rm->flightPlan();
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(fp->totalDistanceNm(), 1025.9, 0.1);
+}
diff --git a/test_suite/unit_tests/Navaids/test_fpNasal.hxx b/test_suite/unit_tests/Navaids/test_fpNasal.hxx
index bc49c1063..9250a0502 100644
--- a/test_suite/unit_tests/Navaids/test_fpNasal.hxx
+++ b/test_suite/unit_tests/Navaids/test_fpNasal.hxx
@@ -36,6 +36,7 @@ class FPNasalTests : public CppUnit::TestFixture
     CPPUNIT_TEST(testApproachTransitionAPI);
     CPPUNIT_TEST(testApproachTransitionAPIWithCloning);
     CPPUNIT_TEST(testAirwaysAPI);
+    CPPUNIT_TEST(testTotalDistanceAPI);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -54,4 +55,5 @@ public:
     void testApproachTransitionAPI();
     void testApproachTransitionAPIWithCloning();
     void testAirwaysAPI();
+    void testTotalDistanceAPI();
 };