diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index a39ea22..24c0bcb 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -630,7 +630,7 @@
 
 static void
 source_script_from_stream (FILE *stream, const char *file,
-			   const char *file_to_open)
+			   const char *file_to_open, bool force)
 {
   if (script_ext_mode != script_ext_off)
     {
@@ -656,6 +656,10 @@
 	  else
 	    throw_ext_lang_unsupported (extlang);
 	}
+      else if (!force && script_ext_mode == script_ext_strict)
+	{
+	  throw_ext_lang_unsupported (&extension_language_none);
+	}
     }
 
   script_from_file (stream, file);
@@ -667,7 +671,8 @@
    search for it in the source search path.  */
 
 static void
-source_script_with_search (const char *file, int from_tty, int search_path)
+source_script_with_search (const char *file, int from_tty, int search_path,
+			   bool force = false)
 {
 
   if (file == NULL || *file == 0)
@@ -695,7 +700,8 @@
      this if we (may have) used search_path, as printing the full path in
      errors for the non-search case can be more noise than signal.  */
   source_script_from_stream (opened->stream.get (), file,
-			     search_path ? opened->full_path.get () : file);
+			     search_path ? opened->full_path.get () : file,
+			     force);
 }
 
 /* Wrapper around source_script_with_search to export it to main.c
@@ -707,6 +713,12 @@
   source_script_with_search (file, from_tty, 0);
 }
 
+void
+source_script_force (const char *file, int from_tty)
+{
+  source_script_with_search (file, from_tty, 0, true);
+}
+
 static void
 source_command (const char *args, int from_tty)
 {
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 94ae814..16f6147 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -120,6 +120,7 @@
 extern void quit_command (const char *, int);
 
 extern void source_script (const char *, int);
+extern void source_script_force (const char *, int);
 
 /* Exported to objfiles.c.  */
 
diff --git a/gdb/extension.c b/gdb/extension.c
index 8637bc5..8a7bea5 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -66,6 +66,18 @@
   auto_load_gdb_scripts_enabled
 };
 
+const struct extension_language_defn extension_language_none =
+{
+  EXT_LANG_NONE,
+  "<unknown>",
+  "<UNKNOWN>",
+  NULL,
+  NULL,
+  invalid_control,
+  NULL,
+  NULL
+};
+
 const struct extension_language_defn extension_language_gdb =
 {
   EXT_LANG_GDB,
@@ -154,6 +166,9 @@
   int i;
   const struct extension_language_defn *extlang;
 
+  if (has_extension (file, extension_language_gdb.suffix))
+    return &extension_language_gdb;
+
   ALL_EXTENSION_LANGUAGES (i, extlang)
     {
       if (has_extension (file, extlang->suffix))
diff --git a/gdb/extension.h b/gdb/extension.h
index fc8e3e2..a59d15a 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -230,6 +230,8 @@
 /* The interface for gdb's own extension(/scripting) language.  */
 extern const struct extension_language_defn extension_language_gdb;
 
+extern const struct extension_language_defn extension_language_none;
+
 extern const struct extension_language_defn *get_ext_lang_defn
   (enum extension_language lang);
 
diff --git a/gdb/main.c b/gdb/main.c
index a77d6ec..c56005a 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -993,7 +993,8 @@
      processed; it sets global parameters, which are independent of
      what file you are debugging or what directory you are in.  */
   if (!system_gdbinit.empty () && !inhibit_gdbinit)
-    ret = catch_command_errors (source_script, system_gdbinit.c_str (), 0);
+    ret = catch_command_errors (source_script_force, system_gdbinit.c_str (),
+				0);
 
   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
      *before* all the command line arguments are processed; it sets
@@ -1001,7 +1002,7 @@
      debugging or what directory you are in.  */
 
   if (!home_gdbinit.empty () && !inhibit_gdbinit && !inhibit_home_gdbinit)
-    ret = catch_command_errors (source_script, home_gdbinit.c_str (), 0);
+    ret = catch_command_errors (source_script_force, home_gdbinit.c_str (), 0);
 
   /* Process '-ix' and '-iex' options early.  */
   for (i = 0; i < cmdarg_vec.size (); i++)
@@ -1117,7 +1118,8 @@
 	{
 	  auto_load_local_gdbinit_loaded = 1;
 
-	  ret = catch_command_errors (source_script, local_gdbinit.c_str (), 0);
+	  ret = catch_command_errors (source_script_force,
+				      local_gdbinit.c_str (), 0);
 	}
     }
 
diff --git a/gdb/testsuite/gdb.base/gdb.bla b/gdb/testsuite/gdb.base/gdb.bla
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gdb.bla
diff --git a/gdb/testsuite/gdb.base/source-execution.exp b/gdb/testsuite/gdb.base/source-execution.exp
index 25e7e37..4fa76b3 100644
--- a/gdb/testsuite/gdb.base/source-execution.exp
+++ b/gdb/testsuite/gdb.base/source-execution.exp
@@ -31,3 +31,8 @@
 gdb_test "source ${srcdir}/${subdir}/source-execution.gdb" \
     "func2.*func3.*" \
     "source source-execution.gdb"
+
+gdb_test_no_output "set script-extension strict"
+
+gdb_test "source gdb.bla" \
+    "Scripting in the \"<UNKNOWN>\" language is not supported in this copy of GDB."
