diff --git a/interface/lib/classes/aps_guicontroller.inc.php b/interface/lib/classes/aps_guicontroller.inc.php
index 8a764a9c5c776618156be1023cdb5ca2a9f4f590..8e4c17af7938bf4e4d867bc65ee84be1eb735b94 100644
--- a/interface/lib/classes/aps_guicontroller.inc.php
+++ b/interface/lib/classes/aps_guicontroller.inc.php
@@ -637,11 +637,27 @@ class ApsGUIController extends ApsBase
 						// The location might be empty but the DB return must not be false!
 						if($location_for_domain) $used_path .= $location_for_domain['value'];
 
+						// If user is trying to install into exactly the same path, give an error
 						if($new_path == $used_path)
 						{
 							$temp_errstr = $app->lng('error_used_location');
 							break;
 						}
+
+						// If the new path is _below_ an existing path, give an error because the
+						// installation will delete the files of the existing APS installation
+						if (mb_substr($used_path, 0, mb_strlen($new_path)) === $new_path) {
+							$temp_errstr = $app->lng('error_used_location');
+							break;
+						}
+
+						// If the new path is _within_ an existing path, give an error. Even if
+						// installation would proceed fine in theory, deleting the "lower" package
+						// in the future would also inadvertedly delete the "nested" package
+						if (mb_substr($new_path, 0, mb_strlen($used_path)) === $used_path) {
+							$temp_errstr = $app->lng('error_used_location');
+							break;
+						}
 					}
 				}
 			}