diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -188,25 +188,60 @@ g_tls_connection_gnutls_init (GTlsConnec
   g_cancellable_cancel (gnutls->priv->waiting_for_op);
 }
 
+/* First field is "ssl3 only", second is "allow unsafe rehandshaking" */
 static gnutls_priority_t priorities[2][2];
 
 static void
 g_tls_connection_gnutls_init_priorities (void)
 {
-  /* First field is "ssl3 only", second is "allow unsafe rehandshaking" */
+  const gchar *g_tls_gnutls_priority = NULL;
+  gchar *g_tls_gnutls_priority_ssl3 = NULL;
+  gchar *g_tls_gnutls_priority_unsafe = NULL;
+  gchar *g_tls_gnutls_priority_ssl3_unsafe = NULL;
 
-  gnutls_priority_init (&priorities[FALSE][FALSE],
-			"NORMAL:%COMPAT",
-			NULL);
-  gnutls_priority_init (&priorities[TRUE][FALSE],
-			"NORMAL:%COMPAT:!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0",
-			NULL);
-  gnutls_priority_init (&priorities[FALSE][TRUE],
-			"NORMAL:%COMPAT:%UNSAFE_RENEGOTIATION",
-			NULL);
-  gnutls_priority_init (&priorities[TRUE][TRUE],
-			"NORMAL:%COMPAT:!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0:%UNSAFE_RENEGOTIATION",
-			NULL);
+  g_tls_gnutls_priority = g_getenv ("G_TLS_GNUTLS_PRIORITY");
+
+  if (g_tls_gnutls_priority != NULL) {
+    g_tls_gnutls_priority_ssl3 = g_strdup_printf ("%s%s",
+						  g_tls_gnutls_priority,
+						  ":!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0");
+    g_tls_gnutls_priority_unsafe = g_strdup_printf ("%s%s",
+						    g_tls_gnutls_priority,
+						    ":%UNSAFE_RENEGOTIATION");
+    g_tls_gnutls_priority_ssl3_unsafe = g_strdup_printf ("%s%s",
+							 g_tls_gnutls_priority,
+							 ":!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0:%UNSAFE_RENEGOTIATION");
+
+    gnutls_priority_init (&priorities[FALSE][FALSE],
+			  g_tls_gnutls_priority,
+			  NULL);
+    gnutls_priority_init (&priorities[TRUE][FALSE],
+			  g_tls_gnutls_priority_ssl3,
+			  NULL);
+    gnutls_priority_init (&priorities[FALSE][TRUE],
+			  g_tls_gnutls_priority_unsafe,
+			  NULL);
+    gnutls_priority_init (&priorities[TRUE][TRUE],
+			  g_tls_gnutls_priority_ssl3_unsafe,
+			  NULL);
+
+    g_free (g_tls_gnutls_priority_ssl3);
+    g_free (g_tls_gnutls_priority_unsafe);
+    g_free (g_tls_gnutls_priority_ssl3_unsafe);
+  } else {
+    gnutls_priority_init (&priorities[FALSE][FALSE],
+			  "NORMAL:%COMPAT",
+			  NULL);
+    gnutls_priority_init (&priorities[TRUE][FALSE],
+			  "NORMAL:%COMPAT:!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0",
+			  NULL);
+    gnutls_priority_init (&priorities[FALSE][TRUE],
+			  "NORMAL:%COMPAT:%UNSAFE_RENEGOTIATION",
+			  NULL);
+    gnutls_priority_init (&priorities[TRUE][TRUE],
+			  "NORMAL:%COMPAT:!VERS-TLS1.2:!VERS-TLS1.1:!VERS-TLS1.0:%UNSAFE_RENEGOTIATION",
+			  NULL);
+  }
 }
 
 static void
