diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index cfd757c6b76bd587ff53386f28c88c221069b0b2..5d5ed2c357b53e19c02cf946870173b363f90a0a 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -1,5 +1,9 @@
 $Id$
 
+2022-05-22  Christian Franke  <franke@computer.org>
+
+	ataprint.cpp: Print Master Password ID if set to non-default value.
+
 2022-05-22  Eaton Zveare  <eaton@eaton-works.com>
 
 	ataprint.cpp: Add master_password_id to ata_security json output
diff --git a/smartmontools/ataprint.cpp b/smartmontools/ataprint.cpp
index fc984e84d2961fd0df56abc1a7f4ce2a1b49e8d5..d3d480974ee82560bfdebc284420ebee25e4bf31 100644
--- a/smartmontools/ataprint.cpp
+++ b/smartmontools/ataprint.cpp
@@ -4,7 +4,7 @@
  * Home page of code is: https://www.smartmontools.org
  *
  * Copyright (C) 2002-11 Bruce Allen
- * Copyright (C) 2008-21 Christian Franke
+ * Copyright (C) 2008-22 Christian Franke
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * SPDX-License-Identifier: GPL-2.0-or-later
@@ -3277,7 +3277,13 @@ static void print_ata_security_status(const char * msg, unsigned short state, un
     }
   }
 
-  jout("%s%s%s%s%s\n", msg, s1, s2, s3, s4);
+  // Print Master Password ID if set to non-default value
+  // (0x0000, 0xffff: unsupported, 0xfffe: default)
+  char s5[32] = "";
+  if (0x0000 < master_password_id && master_password_id < 0xfffe)
+    snprintf(s5, sizeof(s5), ", Master PW ID: 0x%04x", master_password_id);
+
+  jout("%s%s%s%s%s%s\n", msg, s1, s2, s3, s4, s5);
 
   json::ref jref = jglb["ata_security"];
   jref["state"] = state;