Index: /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java	(revision 11679)
+++ /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java	(revision 11680)
@@ -69,4 +69,25 @@
     }
 
+    /**
+     * Returns a comparator ordering the primitives by type in the order RELATION, WAY, NODE
+     *
+     * @return a comparator ordering the primitives by type in the order RELATION, WAY, NODE
+     * @since 11679
+     */
+    public static Comparator<OsmPrimitive> orderingRelationsWaysNodes() {
+        return comparingInt(osm -> {
+            switch (osm.getType()) {
+                case RELATION:
+                    return 1;
+                case WAY:
+                    return 2;
+                case NODE:
+                    return 3;
+                default:
+                    throw new IllegalStateException();
+            }
+        });
+    }
+
     private static <T, R> Function<T, R> memoize(Function<T, R> base) {
         final Map<T, R> cache = new HashMap<>();
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 11679)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 11680)
@@ -17,4 +17,5 @@
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -660,5 +661,8 @@
             if (selection.size() <= Main.pref.getInteger("selection.no_sort_above", 100_000)) {
                 boolean quick = selection.size() > Main.pref.getInteger("selection.fast_sort_above", 10_000);
-                selection.sort(OsmPrimitiveComparator.orderingWaysRelationsNodes().thenComparing(quick
+                Comparator<OsmPrimitive> c = Main.pref.getBoolean("selection.sort_relations_before_ways", true)
+                        ? OsmPrimitiveComparator.orderingRelationsWaysNodes()
+                        : OsmPrimitiveComparator.orderingWaysRelationsNodes();
+                selection.sort(c.thenComparing(quick
                         ? OsmPrimitiveComparator.comparingUniqueId()
                         : OsmPrimitiveComparator.comparingNames()));
