diff --git a/templates/ini_file.erb b/templates/ini_file.erb
index 59b9019cef6f13b4dfa0105bd5e28c2a8f5d5da0..9efc15480f567e5e49d6ddf20b9a5c207057ed1d 100644
--- a/templates/ini_file.erb
+++ b/templates/ini_file.erb
@@ -3,7 +3,17 @@
  # Licensed under the GNU LGPL v3+; see the README file for more information.
  #
 -%>
-<% @settings.sort().each do |section_name, section_vars| -%>
+<%
+    # Sort sections named "default" (case in-sensitive) before others
+    sorted_sections = @settings.keys().select { |k|
+       k.downcase() == 'default'
+    }.sort()
+    sorted_sections += @settings.keys().reject { |k|
+       sorted_sections.include?(k)
+    }.sort()
+    sorted_sections.each do |section_name|
+       section_vars = @settings[section_name]
+-%>
 [<%= section_name %>]
 <%    # Want to align = signs, but only for "short" names
       max_align_pos = 24